|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
|
Re: [PLUG] this code crashes [OT]
|
*bows-head-in-shame*
Ok, I screwed up the return values from the fopen error checking...the fopen()
failures should have looked like this:
src = fopen( sourceFile, "r" );
if( NULL == src ) {
fprintf(stderr,"%s(%d) Error opening file '%s' for reading: %s\n",
__FILE__,__LINE__,sourceFile,strerror(errno));
return errno;
}
dst = fopen( destFile, "w" );
if( NULL == dst ) {
fprintf(stderr,"(%s)%d Error opening file '%s' for writing: %s\n",
__FILE__,__LINE__,sourceFile,strerror(errno));
fclose( src );
return errno;
}
The original code I posted returned 0 (and indication of success they
way I wrote the function).
Sorry 'bout that
Kyle
--
------------------------------------------------------------------------------
Wisdom and Compassion are inseparable.
-- Christmas Humphreys
mortis@voicenet.com http://www.voicenet.com/~mortis
------------------------------------------------------------------------------
______________________________________________________________________
Philadelphia Linux Users Group - http://www.phillylinux.org
Announcements-http://lists.phillylinux.org/mail/listinfo/plug-announce
General Discussion - http://lists.phillylinux.org/mail/listinfo/plug
|
|