Saving Data to File


/ Published in: Objective C
Save to your folder(s)



Copy this code and paste it in your HTML
  1. - (void)saveDataIntoFile:(NSString*)pFilePath
  2. {
  3. char * pBytes;
  4. unsigned length;
  5.  
  6. length = DATAFILE_LENGTH; //custom define
  7. pBytes = malloc(length);
  8.  
  9. // store your data to pBytes here
  10.  
  11. { // Save to file
  12. NSData * pSaveData = [NSData dataWithBytes:pBytes length:length];
  13. [pSaveData writeToFile:pFilePath atomically:FALSE];
  14. }
  15.  
  16. free(pBytes);
  17. }

URL: http://www.cocoabuilder.com/archive/message/cocoa/2003/1/31/77631

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.