Guest claudiuhks Posted May 14, 2012 Posted May 14, 2012 file_exists intoarce true daca fisierul exista indiferent ca este fisier sau director! bool file_exists( char *cFile ){#if defined __linux__ struct stat s; if( stat( cFile, &s ) != 0 ) return false;return true;#else if( GetFileAttributes( cFile ) == INVALID_FILE_ATTRIBUTES ) return false; return true;#endif}
Guest claudiuhks Posted May 14, 2012 Posted May 14, 2012 Un exemplu util: int main( ){ if( file_exists( "myfile.txt" ) ) { FILE *fFile = fopen( "myfile.txt", "r" ); fclose( fFile ); } return 1;}
Recommended Posts