What is up.
RSS icon Email icon Home icon
  • Archives in Cocoa

    Posted on September 21st, 2007 Alan No comments

    If you need to save and load data from files, and you don’t mind creating binary files (don’t need to read or edit them), then Archives are the simplest way to go.

    Load contents of file into an NSArray:

        NSArray* m_ProcessedFiles = [NSKeyedUnarchiver unarchiveObjectWithFile:destPath];

    Save contents of array to file:

        [NSKeyedArchiver archiveRootObject:m_ProcessedFiles toFile:srcPath];       

    Leave a reply