Reading the contents of a file using POSIX functions

- (NSData*)readDataFromFileAtURL:(NSURL*)anURL { NSString* filePath = [anURL path]; fd = open([filePath UTF8String], O_RDONLY); if (fd ==...

2014-08-28 15:12:58

阅读数 586

评论数 0

Reading the contents of a file using NSFileHandle

- (NSData*)readDataFromFileAtURL:(NSURL*)anURL { NSFileHandle* aHandle = [NSFileHandle fileHandleForReadingFromURL:anURL error:nil]; NSData* ...

2014-08-28 14:57:51

阅读数 929

评论数 0

Reading the bytes from a text file using a dispatch I/O channel

- (void)readContentsOfFile:(NSURL*)anURL { // Open the channel for reading. NSString* filePath = [anURL path]; self.channel = dispat...

2014-08-28 14:42:43

阅读数 1006

评论数 0

How to create a custom directory for app files inside the ~/Library/Application Support directory.

- (NSURL*)applicationDirectory { NSString* bundleID = [[NSBundle mainBundle] bundleIdentifier]; Managing Files and Directories Creating New...

2014-08-28 14:03:35

阅读数 811

评论数 0

Filters Limit the File Types That the User Can Select

- (IBAction)askUserForImage:(id)sender { NSOpenPanel* panel = [NSOpenPanel openPanel]; // Let the user select any images supported by // ...

2014-08-28 13:56:05

阅读数 603

评论数 0

Saving a file with a new type

- (void)exportDocument:(NSString*)name toType:(NSString*)typeUTI { NSWindow* window = [[[self windowControllers] objectAtIndex:0] window]; ...

2014-08-28 13:54:13

阅读数 654

评论数 0

Presenting the open panel to the user

- (IBAction)openExistingDocument:(id)sender { NSOpenPanel* panel = [NSOpenPanel openPanel]; // This method displays the panel and returns immed...

2014-08-28 13:48:14

阅读数 501

评论数 0

Retrieving the list of items in a directory all at once

NSURL *url = ; NSError *error = nil; NSArray *properties = [NSArray arrayWithObjects: NSURLLocalizedNameKey, NSURLCreationD...

2014-08-28 11:24:31

阅读数 404

评论数 0

Looking for files that have been modified recently

NSString *directoryPath = ; NSDirectoryEnumerator *directoryEnumerator = [[NSFileManager defaultManager] enumeratorAtPath:directoryPath]; NSDate *yes...

2014-08-28 11:18:03

阅读数 627

评论数 0

提示
确定要删除当前文章?
取消 删除
关闭
关闭