delorie.com/archives/browse.cgi | search |
Message-Id: | <199911270903.LAA15943@www.Foo.COM> |
From: | "S. M. Halloran" <mitch AT duzen DOT com DOT tr> |
Organization: | User RFC 822- and 1123-compliant |
To: | "Yong-Kiang Goh" <ykgoh1 AT singnet DOT com DOT sg>, djgpp AT delorie DOT com |
Date: | Sat, 27 Nov 1999 11:09:52 +0200 |
MIME-Version: | 1.0 |
Subject: | Re: File handling |
In-reply-to: | <81nu0o$v52$1@mango.singnet.com.sg> |
X-mailer: | Pegasus Mail for Win32 (v3.12b) |
Reply-To: | djgpp AT delorie DOT com |
X-Mailing-List: | djgpp AT delorie DOT com |
X-Unsubscribes-To: | listserv AT delorie DOT com |
On 26 Nov 99, Yong-Kiang Goh was found to have commented thusly: > How do I check whether a file exists given its filename without using > fopen() to try to open the file and checking the return code from the > function? Any better way to do it? > > Also, how do I get the size of the file in bytes? Look at the stat() function. If it returns < 0 and you test errno == ENOENT, that's a 99.9% sure indication. If it exists, you can also get the file size from the st_size member of the stat structure returned and filled in by the call to stat(). Mitch Halloran Research (Bio)chemist Duzen Laboratories Group Ankara TURKEY
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |