Something along the lines of: NSString * tempFilePath = [NSTemporaryDirectory() stringByAppendingPathComponent:@"myTempFile.tmp"]; if (![[NSFileManager defaultManager] fileExistsAtPath:tempFilePath]) { [[NSFileManager defaultManager] createFileAtPath:tempFilePath contents:nil attributes:nil]; }
NSFileHandle * outHandle = [NSFileHandle fileHandleForWritingAtPath:tempFilePath]; [myTask setStandardOutput:outHandle]; .... NSString * output = [NSString stringWithContentsOfFile:tempFilePath encoding:NSUTF8StringEncoding error:nil]; [[NSFileManager defaultManager] removeItemAtPath:tempFilePath error:nil]; (typed in Mail.app. YMMV) Dave On Nov 27, 2010, at 10:29 AM, gMail.com wrote: > How do you create the NSFileHandle ? > I succeeded only creating it as > NSFileHandle *theFileH = [NSFileHandle > fileHandleForWritingAtPath:tempFilePath]; > and the file tempFilePath must exists. > > But as I said, I would like to get rid of the temp file. > > -- > Leo _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com