Hi, I made this function which should to log theLinks into theLogFile, and return -1 if there was a problem, 0 if theLinks has just been logged, or 1 if it was logged before. The problem is that somehow sometimes it cannot open theFile even though theLogFile exits at the market line. Does anyone have any idea about the problem? I'm using gcc on a Linux box if it matters. Thanks a lot, Andre # include "logf.h" int logLink( const char * theLink, const char * theLogFile ) { char theLine[ 256 ]; FILE * theFile; bzero( theLine, 256 ); theFile = fopen( theLogFile, "r+" ); if( theFile == NULL ) { theFile = fopen( theLogFile, "w" ); if( theFile == NULL ) It exits here-> return( -1 ); } while( fgets( theLine, 256, theFile ) ) { if( strcmp( theLine, theLink ) == 0 ) { fclose( theFile ); return( 1 ); } } if( fprintf( theFile, "%s", theLink ) < 0 ) { fclose( theFile ); return( -1 ); } fclose( theFile ); return( 0 ); } __________________________________ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com