delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/19/11:21:52

Date: Sun, 19 Oct 1997 17:16:44 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: mark AT bigdog DOT fred DOT net
cc: djgpp AT delorie DOT com
Subject: Re: stat() system call return value problem
In-Reply-To: <62503b$p53@bigdog.fred.net>
Message-ID: <Pine.SUN.3.91.971019171619.27221S-100000@is>
MIME-Version: 1.0

On 16 Oct 1997 mark AT bigdog DOT fred DOT net wrote:

> main()
> {
>   struct stat s;
>   
>   printf("%d\n",stat("test",&s));
> }
> 
> Now if I run this on the linux box the return values for stat
> are correct (0 if it's there, -1 if not). But compiling with
> dos_gcc and running on a win95 machine it always returns a 0.

I cannot reproduce this.  On my machine, also with Windows 95, the
program prints -1 when the file `test' isn't there, 0 when it is.
Please make sure that the file `test' indeed doesn't exist when you
think it doesn't (it might be hidden or something).

If you cannot find the reason to your behavior, please change your
program to print all the members of struct stat that are returned for
`test' and post the output.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019