Re: Newbie's problem with fopen

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
>


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux