• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How to check if file exists?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to check if file exists?


  • Subject: How to check if file exists?
  • From: William Squires <email@hidden>
  • Date: Sat, 10 May 2014 14:06:15 -0500

If I have an NSString that contains a filename (and possibly a path, as typed on the command-line), how can I check to see if the specified file actually exists?

i.e.

...
NSString *inFile = [NSString stringWithUTF8String:argv[1]];
...

let's say, and inFile = @"MyFile.txt".

How can I make sure MyFile.txt exists before trying to read it in?


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: How to check if file exists?
      • From: Quincey Morris <email@hidden>
    • Re: How to check if file exists?
      • From: Fritz Anderson <email@hidden>
  • Prev by Date: Re: Resizing last column of NSTableView when it touches window border
  • Next by Date: Re: How to check if file exists?
  • Previous by thread: Zombie NSWindow
  • Next by thread: Re: How to check if file exists?
  • Index(es):
    • Date
    • Thread