Changeset 3528


Ignore:
Timestamp:
2002-11-12T18:10:30+13:00 (21 years ago)
Author:
jrm21
Message:

fixed write_cfg_line() for when given a filedesc for output instead of a
stream... it wasn't using outconvertclass correctly before.

File:
1 edited

Legend:

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

    r3521 r3528  
    7272  return 0;
    7373}
     74
    7475// same, but use a file descriptor this time
    7576int write_cfg_line (int fileout, const text_tarray &values) {
     
    7980  text_tarray::const_iterator end = values.end();
    8081
    81   bool first = true;
     82  if (here != end) {
     83    char *s=here->getcstr();
     84    write(fileout,s ,here->size());
     85    delete s;
     86
     87    ++here;
     88  }
    8289  while (here != end) {
    83     if (first) text_t2ascii << *here;
    84     else text_t2ascii << "  \"" << *here << "\"";
     90    write(fileout, " \"", 2);
     91    char *s=here->getcstr();
     92    write(fileout,s ,here->size());
     93    delete s;
     94    write(fileout, "\"", 1);
    8595
    86     size_t buffersize=here->size() + 4; // +4 in case of " and spaces
    87     char *buffer=new char[buffersize];
    88     size_t num_chars;
    89     convertclass::status_t status;
    90     text_t2ascii.convert(buffer, buffersize, num_chars, status);
    91     // ignore status - assume it is "finished" as buffer is big enough
    92     write(fileout, buffer, num_chars);
    93     delete[] buffer;
    94     first = false;
    95     here ++;
     96    ++here;
    9697  }
    9798  write(fileout,"\n",1);
Note: See TracChangeset for help on using the changeset viewer.