spielwiese
Last change
on this file since 26e030 was
26e030,
checked in by Hans Schönemann <hannes@…>, 15 years ago
|
*hannes: update to 5.5.1
git-svn-id: file:///usr/local/Singular/svn/trunk@11949 2c84dea3-7e68-4137-9b89-c4e89433aadc
|
-
Property mode set to
100644
|
File size:
925 bytes
|
Line | |
---|
1 | |
---|
2 | #include <NTL/fileio.h> |
---|
3 | |
---|
4 | #include <string.h> |
---|
5 | |
---|
6 | #include <NTL/new.h> |
---|
7 | |
---|
8 | NTL_START_IMPL |
---|
9 | |
---|
10 | |
---|
11 | void OpenWrite(ofstream& s, const char *name) |
---|
12 | { |
---|
13 | s.open(name, ios::out); |
---|
14 | |
---|
15 | if (!s) { |
---|
16 | cerr << "open write error: " << name; |
---|
17 | Error(""); |
---|
18 | } |
---|
19 | } |
---|
20 | |
---|
21 | |
---|
22 | void OpenRead(ifstream& s, const char *name) |
---|
23 | { |
---|
24 | s.open(name, ios::in); |
---|
25 | if (!s) { |
---|
26 | cerr << "open read error: " << name; |
---|
27 | Error(""); |
---|
28 | } |
---|
29 | } |
---|
30 | |
---|
31 | static char sbuf[256]; |
---|
32 | |
---|
33 | char *FileName(const char* stem, const char *ext) |
---|
34 | { |
---|
35 | strcpy(sbuf, stem); |
---|
36 | strcat(sbuf, "-"); |
---|
37 | strcat(sbuf, ext); |
---|
38 | |
---|
39 | return sbuf; |
---|
40 | } |
---|
41 | |
---|
42 | char *FileName(const char* stem, const char *ext, long d) |
---|
43 | { |
---|
44 | strcpy(sbuf, stem); |
---|
45 | strcat(sbuf, "-"); |
---|
46 | strcat(sbuf, ext); |
---|
47 | strcat(sbuf, "-"); |
---|
48 | |
---|
49 | char dbuf[6]; |
---|
50 | dbuf[5] = '\0'; |
---|
51 | long i, dd; |
---|
52 | dd = d; |
---|
53 | for (i = 4; i >= 0; i--) { |
---|
54 | dbuf[i] = IntValToChar(dd % 10); |
---|
55 | dd = dd / 10; |
---|
56 | } |
---|
57 | |
---|
58 | strcat(sbuf, dbuf); |
---|
59 | |
---|
60 | return sbuf; |
---|
61 | } |
---|
62 | |
---|
63 | NTL_END_IMPL |
---|
Note: See
TracBrowser
for help on using the repository browser.