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: Ishwar Rattan <ishwar at cps dot cmich dot edu>
- To: Andre Kirchner <sieg1974 at yahoo dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Sat, 27 Sep 2003 10:01:18 -0400 (EDT)
- Subject: Re: Newbie's problem with fopen
- References: <20030927025554.1177.qmail@web41405.mail.yahoo.com>
Success in using library functions and system calls depends on
looking at the error returned (trap the error) and read the
man page. It has nothing to do with gcc.
-ishwar
On Fri, 26 Sep 2003, Andre Kirchner wrote:
> 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
>