• 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
Re: Read lines from very large text file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Read lines from very large text file


  • Subject: Re: Read lines from very large text file
  • From: Clark Cox <email@hidden>
  • Date: Fri, 6 Feb 2009 21:39:28 -0800

On Fri, Feb 6, 2009 at 9:30 PM, Sean McBride <email@hidden> wrote:
> Joar Wingfors (email@hidden) on 2009-02-06 12:06 AM said:
>
>>> How can you guarantee a file's existence?  sudo rm -f?
>>
>>How about calling open() on it?
>
> :)  But note the latter part of the sentence: "this method should only
> be used if the file is guaranteed to exist _for the duration of the data
> object's existence_."  So if I create an NSData with
> dataWithContentsOfMappedFile and then the user deletes the backing file,
> then what?

Even if you delete the file from the filesystem, you are just deleting
the mapping from that particular filename to the file's actual data.
The actual "file" still there until the last process with an open
handle closes it, so open()'ing a file will guarantee that it exists
until you close() it, or your process terminates.

>I just tried in a little test app: open(),
> dataWithContentsOfMappedFile, breakpoint, rm file, access the NSData.
> Seems to work.

Indeed.

--
Clark S. Cox III
email@hidden
_______________________________________________

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: Read lines from very large text file
      • From: Michael Ash <email@hidden>
    • Re: Read lines from very large text file
      • From: Chris Ridd <email@hidden>
References: 
 >Re: Read lines from very large text file (From: Matt Neuburg <email@hidden>)
 >Re: Read lines from very large text file (From: Michael Ash <email@hidden>)
 >Re: Read lines from very large text file (From: "Sean McBride" <email@hidden>)
 >Re: Read lines from very large text file (From: Joar Wingfors <email@hidden>)
 >Re: Read lines from very large text file (From: "Sean McBride" <email@hidden>)

  • Prev by Date: Syntax errors, undeclared variables
  • Next by Date: Re: @synchronized in thread safe accessors
  • Previous by thread: Re: Read lines from very large text file
  • Next by thread: Re: Read lines from very large text file
  • Index(es):
    • Date
    • Thread