Skip to content

Instantly share code, notes, and snippets.

@piaoapiao
Created October 26, 2012 02:21
Show Gist options
  • Save piaoapiao/3956562 to your computer and use it in GitHub Desktop.
Save piaoapiao/3956562 to your computer and use it in GitHub Desktop.
archive
int buf = 0x12121212;
NSData *data=[[NSData alloc]initWithBytes:&buf length:4];
NSString *string=[[NSString alloc]initWithString:@"dsfasdf"];
NSArray *array=[[NSArray alloc]initWithObjects:@"first",@"second",[NSNumber numberWithInt:123], nil];
NSMutableArray *array2=[[NSMutableArray alloc]initWithObjects:@"first",@"second",[NSNumber numberWithInt:123], nil];
[array2 addObject:array];
[array2 addObject:data];
NSDictionary *dictionary = [[NSDictionary alloc] initWithObjectsAndKeys:@"abc",@"first",@"def",@"second" , nil];
[data writeToFile:@"/Users/admin/Desktop/text1.txt" atomically:YES];
[string writeToFile:@"/Users/admin/Desktop/text2.txt" atomically:YES];
[array2 writeToFile:@"/Users/admin/Desktop/text3.txt" atomically:YES];
[dictionary writeToFile:@"/Users/admin/Desktop/text4.txt" atomically:YES];
NSArray *getArray = [NSArray arrayWithContentsOfFile:@"/Users/admin/Desktop/text3.txt"];
NSData *data2 = [getArray objectAtIndex:4];
NSData *data3 = [NSData dataWithContentsOfFile:@"/Users/admin/Desktop/text1.txt"];
NSString *unString = [NSString stringWithContentsOfFile:@"/Users/admin/Desktop/text2.txt" encoding:NSUTF8StringEncoding error:nil];
NSDictionary *undic = [NSDictionary dictionaryWithContentsOfFile:@"/Users/admin/Desktop/text4.txt" ];
http://blog.csdn.net/holydancer/article/details/7371643
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment