Last change
on this file since 611 was 611, checked in by sjboddie, 25 years ago |
initial commit of windows server code
|
-
Property svn:executable
set to
*
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
686 bytes
|
Line | |
---|
1 | #include "text_t.h"
|
---|
2 | #include "conftools.h"
|
---|
3 |
|
---|
4 | int write_confline (ofstream &fileout, const text_t &key, const text_t value) {
|
---|
5 | if (key.empty() || value.empty()) return -1;
|
---|
6 | outconvertclass text_t2ascii;
|
---|
7 | fileout << text_t2ascii << key << "=" << value << "\n";
|
---|
8 | return 0;
|
---|
9 | }
|
---|
10 |
|
---|
11 | int get_confline (ifstream &filein, text_t &key, text_t &value) {
|
---|
12 | if (filein.eof()) return -1;
|
---|
13 |
|
---|
14 | key.clear();
|
---|
15 | value.clear();
|
---|
16 | char c;
|
---|
17 | filein.get(c);
|
---|
18 |
|
---|
19 | int foundeq = 0;
|
---|
20 | while (!filein.eof() && c != '\n') {
|
---|
21 | if (!foundeq && c == '=') {foundeq = 1; filein.get(c);}
|
---|
22 |
|
---|
23 | if (foundeq) value.push_back(c);
|
---|
24 | else key.push_back(c);
|
---|
25 | filein.get(c);
|
---|
26 | }
|
---|
27 | if (key.empty()) return -1;
|
---|
28 | return 0;
|
---|
29 | }
|
---|
30 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.