// Get Documents Directory
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
// Create Directory
NSString *tmpDir = [documentsDirectory stringByAppendingPathComponent:@"test_dir"];
mkdir([tmpDir cStringUsingEncoding:NSASCIIStringEncoding], 0777);
// Open File
NSString *tmpFile = [documentsDirectory stringByAppendingPathComponent:@"test_file.txt"];
FILE *file = fopen([tempFile cStringUsingEncoding:NSASCIIStringEncoding], "w");;