• 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: Saving data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Saving data


  • Subject: Re: Saving data
  • From: Nico <email@hidden>
  • Date: Fri, 31 Jan 2003 20:27:38 +0100

Joseph,

simply do the following:

- (void)saveDataIntoFile:(NSString*)pFilePath
{
char * pBytes;
unsigned length;

length = DATAFILE_LENGTH; //custom define
pBytes = malloc(length);

// store your data to pBytes here

{ // Save to file
NSData * pSaveData = [NSData dataWithBytes:pBytes length:length];
[pSaveData writeToFile:pFilePath atomically:FALSE];
}

free(pBytes);
}

Hope that helps!

Nico


On Dienstag, Januar 28, 2003, at 07:00 Uhr, cocoa-dev-
email@hidden wrote:

Hey all,

How do I save data into a file? I have 2 books on Cocoa programming
(Cocoa Programming with Mac OS X, and Learning Cocoa with Objective C)
and they only show you how to do it using a Cocoa Document Application.
Is there a way to do it with a normal single window/nib file Cocoa
Application?

Thanks,

Joseph
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: including library in .app
  • Next by Date: Custom Controls
  • Previous by thread: Re: Saving data
  • Next by thread: Setting the Default Browser?
  • Index(es):
    • Date
    • Thread