to judge a file


 
Thread Tools Search this Thread
Top Forums Programming to judge a file
# 1  
Old 08-26-2005
to judge a file

HI all
I am a newer learning C that I want to write a code to judge a file whether exist or not
And rename it. Maybe someone can tell me C whether has function to do it
thx
# 2  
Old 08-27-2005
See fopen() library function ...
$man fopen
# 3  
Old 08-29-2005
fopen will return a NULL.

stat() also works. The advantage of stat() is that you get information about how you are allowed to open the file - ie., do you have access?. stat will not return an error if you have execute access to the directory, but no read access to the file. fopen will return an error.
Login or Register to Ask a Question

Previous Thread | Next Thread

1 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to judge wether a url is valid or not using awk

rt 3ks:confused: (6 Replies)
Discussion started by: rainboisterous
6 Replies
Login or Register to Ask a Question