Changeset 3010
- Timestamp:
- 2002-02-27T11:57:02+13:00 (22 years ago)
- Location:
- trunk/gsdl/lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/lib/cfgread.cpp
r1739 r3010 71 71 return 0; 72 72 } 73 // same, but use a file descriptor this time 74 int write_cfg_line (int fileout, const text_tarray &values) { 75 outconvertclass text_t2ascii; 76 77 text_tarray::const_iterator here = values.begin(); 78 text_tarray::const_iterator end = values.end(); 79 80 bool first = true; 81 while (here != end) { 82 if (first) text_t2ascii << *here; 83 else text_t2ascii << " \"" << *here << "\""; 84 85 size_t buffersize=here->size() + 4; // +4 in case of " and spaces 86 char *buffer=new char[buffersize]; 87 size_t num_chars; 88 convertclass::status_t status; 89 text_t2ascii.convert(buffer, buffersize, num_chars, status); 90 // ignore status - assume it is "finished" as buffer is big enough 91 write(fileout, buffer, num_chars); 92 delete buffer; 93 first = false; 94 here ++; 95 } 96 write(fileout,"\n",1); 97 return 0; 98 } 99 73 100 74 101 // returns 0 on success, -1 on failure -
trunk/gsdl/lib/cfgread.h
r1421 r3010 43 43 int read_ini_line (ifstream &filein, text_t &key, text_t &value); 44 44 int write_cfg_line (ofstream &fileout, const text_tarray &values); 45 int write_cfg_line (int filedesc, const text_tarray &values); 45 46 int read_cfg_line (ifstream &filein, text_tarray &values); 46 47
Note:
See TracChangeset
for help on using the changeset viewer.