Re: File exist
- From: "Claude Yih" <wing0630@xxxxxxxxx>
- Date: 18 Apr 2006 02:59:14 -0700
Keith Thompson wrote:
ed <ed@xxxxxxxxxxx> writes:
On 16 Apr 2006 01:53:03 -0700[...]
paytam@xxxxxxxxx wrote:
Can anyone tell me how can I check that a file exist or no.
Try using stat(5).
There is no stat() function in standard C. Using it will limit the
portability of your code. See comp.unix.programmer.
I learnt from others that there is a function named access can be used
to detect if a dedicated file exists. The function is as follows:
int access (char* filename, int mode)
For instance, if I wanted to know whether /opt/test.log exists, I would
call this function as
int flag = access("/opt/test.log", 0);
However, this function is included in <io.h>, perhaps it's not a
standard function either.
.
- Follow-Ups:
- Re: File exist
- From: Flash Gordon
- Re: File exist
- References:
- File exist
- From: paytam
- Re: File exist
- From: ed
- Re: File exist
- From: Keith Thompson
- File exist
- Prev by Date: Re: GCC support for CX options
- Next by Date: Re: File exist
- Previous by thread: Re: File exist
- Next by thread: Re: File exist
- Index(es):
Relevant Pages
|