Return to Snippet

Revision: 5229
at February 21, 2008 01:50 by zingo


Initial Code
- (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);
}

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

Initial Description


Initial Title
Saving Data to File

Initial Tags
file, osx

Initial Language
Objective C