Changeset 1421


Ignore:
Timestamp:
2000-08-18T14:45:59+12:00 (24 years ago)
Author:
sjboddie
Message:

Added a fairly primitive function for writing out lines to configuration
files.

Location:
trunk/gsdl/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/lib/cfgread.cpp

    r1310 r1421  
    5353}
    5454
     55// write out line of values to cfgfile
     56// does nothing fancy - make sure no values contain carriage returns
     57int write_cfg_line (ofstream &fileout, const text_tarray &values) {
     58  outconvertclass text_t2ascii;
     59
     60  text_tarray::const_iterator here = values.begin();
     61  text_tarray::const_iterator end = values.end();
     62
     63  bool first = true;
     64  while (here != end) {
     65    if (first) fileout << text_t2ascii << *here;
     66    else fileout << text_t2ascii << "  \"" << *here << "\"";
     67    first = false;
     68    here ++;
     69  }
     70  fileout << "\n";
     71}
    5572
    5673// returns 0 on success, -1 on failure
  • trunk/gsdl/lib/cfgread.h

    r1310 r1421  
    4242int write_ini_line (ofstream &fileout, const text_t &key, const text_t value);
    4343int read_ini_line (ifstream &filein, text_t &key, text_t &value);
     44int write_cfg_line (ofstream &fileout, const text_tarray &values);
    4445int read_cfg_line (ifstream &filein, text_tarray &values);
    4546
Note: See TracChangeset for help on using the changeset viewer.