Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/fstream.c

    r829c907 r6152c81  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar 21 20:56:10 2017
    13 // Update Count     : 215
     12// Last Modified On : Tue Mar  7 14:48:09 2017
     13// Update Count     : 192
    1414//
    1515
     
    3333void sepReset( ofstream * os ) { os->sepOnOff = os->sepDefault; }
    3434void sepReset( ofstream * os, _Bool reset ) { os->sepDefault = reset; os->sepOnOff = os->sepDefault; }
    35 
    36 const char * sepGetCur( ofstream * os ) { return os->sepCur; }
    37 void sepSetCur( ofstream * os, const char * sepCur ) { os->sepCur = sepCur; }
    38 
    3935const char * sepGet( ofstream * os ) { return &(os->separator[0]); }
    4036
     
    4238        strncpy( &(os->separator[0]), s, separateSize - 1 );
    4339        os->separator[separateSize - 1] = '\0';
    44 } // sepSet
    45 
    46 const char * sepGetTuple( ofstream * os ) { return &(os->tupleSeparator[0]); }
    47 
    48 void sepSetTuple( ofstream * os, const char * s ) {
    49         strncpy( &(os->tupleSeparator[0]), s, separateSize - 1 );
    50         os->tupleSeparator[separateSize - 1] = '\0';
    5140} // sepSet
    5241
     
    10695} // write
    10796
    108 int fmt( ofstream * os, const char format[], ... ) {
     97int prtfmt( ofstream * os, const char fmt[], ... ) {
    10998        va_list args;
    110         va_start( args, format );
    111         int len = vfprintf( (FILE *)(os->file), format, args );
     99        va_start( args, fmt );
     100        int len = vfprintf( (FILE *)(os->file), fmt, args );
    112101        if ( len == EOF ) {
    113102                if ( ferror( (FILE *)(os->file) ) ) {
     
    120109        sepReset( os );                                                                         // reset separator
    121110        return len;
    122 } // fmt
     111} // prtfmt
    123112
    124 void ?{}( ofstream * this, void * file, _Bool sepDefault, _Bool sepOnOff, const char * separator, const char * tupleSeparator ) {
    125         this->file = file;
    126         this->sepDefault = sepDefault;
    127         this->sepOnOff = sepOnOff;
    128         sepSet( this, separator );
    129         sepSetCur( this, sepGet( this ) );
    130         sepSetTuple( this, tupleSeparator );
    131 }
    132113
    133 static ofstream soutFile = { (FILE *)(&_IO_2_1_stdout_), 1, 0, " ", ", " };
     114static ofstream soutFile = { (FILE *)(&_IO_2_1_stdout_), 1, 0, { ' ', '\0' } };
    134115ofstream *sout = &soutFile;
    135 static ofstream serrFile = { (FILE *)(&_IO_2_1_stderr_), 1, 0, " ", ", " };
     116static ofstream serrFile = { (FILE *)(&_IO_2_1_stderr_), 1, 0, { ' ', '\0' } };
    136117ofstream *serr = &serrFile;
    137118
     
    192173} // ungetc
    193174
    194 int fmt( ifstream * is, const char format[], ... ) {
     175int scanfmt( ifstream * is, const char fmt[], ... ) {
    195176        va_list args;
    196177
    197         va_start( args, format );
    198         int len = vfscanf( (FILE *)(is->file), format, args );
     178        va_start( args, fmt );
     179        int len = vfscanf( (FILE *)(is->file), fmt, args );
    199180        if ( len == EOF ) {
    200181                if ( ferror( (FILE *)(is->file) ) ) {
     
    205186        va_end( args );
    206187        return len;
    207 } // fmt
     188} // prtfmt
    208189
    209190
Note: See TracChangeset for help on using the changeset viewer.