• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
problem with NSFileHandle's readDataToEndOfFile
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

problem with NSFileHandle's readDataToEndOfFile


  • Subject: problem with NSFileHandle's readDataToEndOfFile
  • From: Josh Anon <email@hidden>
  • Date: Thu, 26 Dec 2002 13:42:06 -0500

Hi all,
My app makes an NSTask which calls a program that makes a large (> 30 MB) image and dumps it to standard out. What I'm trying to do is then read the output and create a NSBitmapImageRep from it. The code is basically:

NSTask *myTask;
NSPipe *outPipe = [NSPipe pipe];
NSFileHandle *readHandle = [outPipe fileHandleForReading];
NSData *imageData;
//...
[task setStandardOutput:outPipe];
[task setLaunchPath:somePath];
[task launch];
//* bookmark
imageData = [NSData dataWithData:[readHandle readDataToEndOfFile]];
rep = [NSBitmapImageRep imageRepWithData:imageData];

the problem is that imageData is only ~1/2 as long as it should be, so rep ends up being nil. I tried calling [task waitUntilExit] at //* bookmark, but then something deadlocked so the process never quit and my app never continued. If I manually call the process and pipe the output to a file, and then load the data/image from the file, everything works fine.

Any ideas? Thanks!
Josh
--
//email@hidden || http://www.areax.net
"As a first approximation we have modeled a gelatin cube governed by the first order Jell-O Equation with judiciously selected surface properties, i.e. color=(0,255,0)." - [Heckbert 87]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
  • Prev by Date: Re: Omission of % character when loading a string from a file?
  • Next by Date: Re: *Really* Understanding Cocoa
  • Previous by thread: Re: Omission of % character when loading a string from a file?
  • Next by thread: Re: problem with NSFileHandle's readDataToEndOfFile
  • Index(es):
    • Date
    • Thread