This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Newbie's problem with fopen
- From: Andre Kirchner <sieg1974 at yahoo dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Fri, 26 Sep 2003 19:55:54 -0700 (PDT)
- Subject: Re: Newbie's problem with fopen
Hi,
after a lot of debug I realize that there was nothing
wrong with fopen at logLink, but with opendir in
makeSubDir.
makeSubDir creates the following new subdirectory. All
subdirectories are like /home/andre/001,
/home/andre/002, ...
The problem is that even though a directory exists,
sometimes opendir can't open it, and returns NULL.
Does anyone have any idea about what could be wrong?
Thanks,
Andre
int makeSubDir( const char * theDirectory, char *
newSubDirectory )
{
int subDir = 0;
if( opendir( theDirectory ) == 0 )
return( -1 );
do
{
subDir++;
sprintf( newSubDirectory, "%s/%03d", theDirectory,
subDir );
}
while( opendir( newSubDirectory ) );
mkdir( newSubDirectory, S_IRUSR + S_IWUSR + S_IXUSR
);
if( opendir( newSubDirectory ) == 0 )
return( -1 );
return( 0 );
}
__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com