Skip navigation.
 
mlRe: Saving data
FROM : Nico
DATE : Fri Jan 31 20:27:38 2003

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_removed> 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_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Related mailsAuthorDate
mlSaving data Joseph Tesmer Jan 28, 05:38
mlRe: Saving data Isaac Sherman Jan 28, 06:03
mlRe: Saving data Nico Jan 31, 20:27