Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Ways fopen() Failes

Reply
Thread Tools

Ways fopen() Failes

 
 
Nathaniel Wingard
Guest
Posts: n/a
 
      09-16-2003
I am trying to do a basic file check (see if the file exists) and I am using
the command fopen(argv[1], "r") to check. However I am afraid that it may
fail even if the file does exist if the file is on a networked drive
(similar to the way rename() dies. It isn't in any of the documentation,
does anyone know if it has any problems like this?
Thanks
Nathaniel


 
Reply With Quote
 
 
 
 
Eric Sosman
Guest
Posts: n/a
 
      09-16-2003
Nathaniel Wingard wrote:
>
> I am trying to do a basic file check (see if the file exists) and I am using
> the command fopen(argv[1], "r") to check. However I am afraid that it may
> fail even if the file does exist if the file is on a networked drive
> (similar to the way rename() dies. It isn't in any of the documentation,
> does anyone know if it has any problems like this?


This is Question 19.11 in the comp.lang.c Frequently
Asked Questions (FAQ) list

http://www.eskimo.com/~scs/C-faq/top.html

--
http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
 
 
 
Mike Wahler
Guest
Posts: n/a
 
      09-16-2003
Nathaniel Wingard <(E-Mail Removed)> wrote in message
news:bk7kno$blk$(E-Mail Removed)...
> I am trying to do a basic file check (see if the file exists)


There's no way to do that with standard C.

>and I am using
> the command fopen(argv[1], "r") to check.


The only thing you can learn from 'fopen()'s return value
is, was the file opened successfully or not. *Why* cannot
be determined.

> However I am afraid that it may
> fail even if the file does exist if the file is on a networked drive


Yes, depending upon the environment, there are any number of
reasons that a file could not be opened.

>
> (similar to the way rename() dies.


'rename()' will return zero if successful, nonzero if not.
If it fails, why cannot be determined.

> It isn't in any of the documentation,


It's not part of the standard C language.

> does anyone know if it has any problems like this?


I don't see any 'problem'.

What you're asking about is platform-specific behavior.
Consult your implementation and/or operating system
documentation. Most OS's feature API calls for more
intimate interaction with e.g. a file system.

-Mike




 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ipconfig failes! RickMerrill Computer Support 19 09-28-2010 06:19 PM
Service name WSCSVC failes to start part 2 Dag N Wireless Networking 1 03-19-2007 02:08 PM
Service name WSCSVC failes to start Dag N Wireless Networking 2 03-16-2007 01:53 PM
loading an applet failes marcwentink@hotmail.com Java 9 12-09-2005 06:19 PM
askstring => grab failes wes weston Python 1 04-27-2004 09:50 AM



Advertisments