public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ishwar Rattan <ishwar@cps.cmich.edu>
To: Andre Kirchner <sieg1974@yahoo.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: Newbie's problem with fopen
Date: Sat, 27 Sep 2003 14:21:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.56.0309270959390.17118@pali.cps.cmich.edu> (raw)
In-Reply-To: <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
>

  parent reply	other threads:[~2003-09-27 14:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-27  2:55 Andre Kirchner
2003-09-27 13:33 ` Eljay Love-Jensen
2003-09-27 14:21 ` Ishwar Rattan [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-09-26  0:57 Andre Kirchner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.56.0309270959390.17118@pali.cps.cmich.edu \
    --to=ishwar@cps.cmich.edu \
    --cc=gcc-help@gcc.gnu.org \
    --cc=sieg1974@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).