Richard
int main (int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
//File Managment
NSString* fileName = @"SongList.txt";
NSString* homeDir = NSHomeDirectory();
NSString* fullPath = [homeDir stringByAppendingPathComponent:fileName];
//Data passing file allocation
NSMutableData* buffer1 = [[NSMutableData alloc] init];
NSMutableData* buffer2 = [NSMutableData dataWithData:buffer1];
//Arrays
NSMutableArray *songArray = [[NSMutableArray alloc]init];
NSArray *songName = [NSArray arrayWithObjects:@"Layla",@"Bridge Over Troubled Water",@"Let It Be",@"Your Song",@"Get Up (I Feel Like Being A) Sex Machine",@"Lola",@"Who'll Stop the Rain",@"Fire and Rain",@"Paranoid",@"All Right Now", nil];
//Data manipulation
for (int i=0; i<10; i++) {
[songArray addObject:[songName objectAtIndex:i]];
buffer1 = [songArray objectAtIndex:i];
[buffer2 appendData:buffer1];
}
//Write array to file
[buffer2 writeToFile:fullPath atomically:YES];
//Memory Managment
[buffer2 release];
[buffer1 release];
[pool drain];
return 0;
}

New Topic/Question
Reply



MultiQuote




|