• 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 write a string to a file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to write a string to a file


  • Subject: How to write a string to a file
  • From: David <email@hidden>
  • Date: Mon, 18 Aug 2008 23:00:29 -0400

I know it sounds like a basic question, but I've looked and it doesn't seem
as obvious to me as it should.
I want to write out data to a file to describe my tree structure.

I'd like to have a method which appends a string to the end of a text file.

I don't really want to store everything in memory and write out one big
string because it might get quite large.

How are you supposed to do this in Cocoa? Why isn't it more obvious?

I've looked in NSString, NSData, NSFileHandle, NSOutputStream, but I don't
see a simple way to append a string to a file. Can it really be this hard?

NSString doesn't have a method to append to a file, nor a stream, nor
NSData.
And the other classes don't have a method to accept a string.

Thanks
_______________________________________________

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 write a string to a file
      • From: David <email@hidden>
    • Re: How to write a string to a file
      • From: Ken Thomases <email@hidden>
    • Re: How to write a string to a file
      • From: "Adam R. Maxwell" <email@hidden>
  • Prev by Date: Re: Using Flex/Lex in a Cocoa project
  • Next by Date: Re: How to write a string to a file
  • Previous by thread: Re: Including frameworks in your app bundle
  • Next by thread: Re: How to write a string to a file
  • Index(es):
    • Date
    • Thread