Changes in / [32a1d654:6ba16fa]
- Location:
- src/libcfa
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/fstream
r32a1d654 r6ba16fa 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Dec 7 15:17:26201713 // Update Count : 1 3012 // Last Modified On : Thu Dec 7 08:06:11 2017 13 // Update Count : 129 14 14 // 15 15 … … 52 52 int flush( ofstream & ); 53 53 void open( ofstream &, const char * name, const char * mode ); 54 void open( ofstream &, const char * name );55 54 void close( ofstream & ); 56 55 ofstream & write( ofstream &, const char * data, unsigned long int size ); … … 59 58 void ?{}( ofstream & os ); 60 59 void ?{}( ofstream & os, const char * name, const char * mode ); 61 void ?{}( ofstream & os, const char * name );62 60 63 61 extern ofstream & sout, & serr; … … 71 69 int fail( ifstream & is ); 72 70 int eof( ifstream & is ); 73 void open( ifstream & is, const char * name, const char * mode );74 71 void open( ifstream & is, const char * name ); 75 72 void close( ifstream & is ); … … 79 76 80 77 void ?{}( ifstream & is ); 81 void ?{}( ifstream & is, const char * name, const char * mode );82 78 void ?{}( ifstream & is, const char * name ); 83 79 -
src/libcfa/fstream.c
r32a1d654 r6ba16fa 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Dec 9 09:31:23201713 // Update Count : 27 512 // Last Modified On : Thu Dec 7 08:35:01 2017 13 // Update Count : 270 14 14 // 15 15 … … 46 46 47 47 // public 48 void ?{}( ofstream & os ) { os.file = 0;}48 void ?{}( ofstream & os ) {} 49 49 50 50 void ?{}( ofstream & os, const char * name, const char * mode ) { 51 51 open( os, name, mode ); 52 }53 void ?{}( ofstream & os, const char * name ) {54 open( os, name, "w" );55 52 } 56 53 … … 87 84 88 85 int fail( ofstream & os ) { 89 return os.file == 0 ||ferror( (FILE *)(os.file) );86 return ferror( (FILE *)(os.file) ); 90 87 } // fail 91 88 … … 96 93 void open( ofstream & os, const char * name, const char * mode ) { 97 94 FILE *file = fopen( name, mode ); 98 //if ( file == 0 ) { // do not change unless successful99 //fprintf( stderr, IO_MSG "open output file \"%s\", ", name );100 //perror( 0 );101 //exit( EXIT_FAILURE );102 //} // if95 if ( file == 0 ) { // do not change unless successful 96 fprintf( stderr, IO_MSG "open output file \"%s\", ", name ); 97 perror( 0 ); 98 exit( EXIT_FAILURE ); 99 } // if 103 100 (os){ file, true, false, " ", ", " }; 104 } // open105 106 void open( ofstream & os, const char * name ) {107 open( os, name, "w" );108 101 } // open 109 102 … … 159 152 160 153 // public 161 void ?{}( ifstream & is ) { is.file = 0; } 162 163 void ?{}( ifstream & is, const char * name, const char * mode ) { 164 open( is, name, mode ); 165 } 154 void ?{}( ifstream & is ) {} 155 166 156 void ?{}( ifstream & is, const char * name ) { 167 open( is, name , "r");157 open( is, name ); 168 158 } 169 159 170 160 int fail( ifstream & is ) { 171 return is.file == 0 ||ferror( (FILE *)(is.file) );161 return ferror( (FILE *)(is.file) ); 172 162 } // fail 173 163 … … 176 166 } // eof 177 167 178 void open( ifstream & is, const char * name , const char * mode) {179 FILE *file = fopen( name, mode);180 //if ( file == 0 ) { // do not change unless successful181 //fprintf( stderr, IO_MSG "open input file \"%s\", ", name );182 //perror( 0 );183 //exit( EXIT_FAILURE );184 //} // if168 void open( ifstream & is, const char * name ) { 169 FILE *file = fopen( name, "r" ); 170 if ( file == 0 ) { // do not change unless successful 171 fprintf( stderr, IO_MSG "open input file \"%s\", ", name ); 172 perror( 0 ); 173 exit( EXIT_FAILURE ); 174 } // if 185 175 is.file = file; 186 } // open187 188 void open( ifstream & is, const char * name ) {189 open( is, name, "r" );190 176 } // open 191 177
Note: See TracChangeset
for help on using the changeset viewer.