• 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
Re: accessing newly-created files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: accessing newly-created files


  • Subject: Re: accessing newly-created files
  • From: Allan Odgaard <email@hidden>
  • Date: Mon, 19 Apr 2004 23:23:02 +0200

On 19. Apr 2004, at 22:23, David Piasecki wrote:

I tried creating a named pipe, but I'm having some trouble reading from it. A simple example works just fine for something like cat, but I get a broken pipe error when attempting to read it in as an image in Objective-C.

That sucks! Most likely NSImage does something like first opening the file to read the header, then close and re-open later to re-read the file, but this time decode the image data or similar which would not work for a named pipe :-/

You can take over the loading by using initForIncrementalLoad and incrementalLoadFromData:complete:, but that's too much work IMHO.

I'm going to try simply reading in the file the standard C/C++ way and passing the bytes to the NSImage. Is that what you were originally thinking? I'll let you know if it works.

I had hoped that the named pipe would work w/o any tweaks -- bug seeing that NSImage is incompatible with a FIFO and that you are forced to read all into an NSData, you can let your helper program (creating the image) write to stdout (instead of a file) and then use popen() instead of mkfifo(). This might save a line or two of code and does then not require a name in the filesystem.








** Cocoa FAQ: <http://www.alastairs-place.net/cocoa/faq.txt> **
_______________________________________________
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.


  • Follow-Ups:
    • Re: accessing newly-created files
      • From: "David Piasecki" <email@hidden>
    • Re: accessing newly-created files
      • From: "David Piasecki" <email@hidden>
    • Re: accessing newly-created files
      • From: "David Piasecki" <email@hidden>
References: 
 >accessing newly-created files (From: "David Piasecki" <email@hidden>)
 >Re: accessing newly-created files (From: Allan Odgaard <email@hidden>)
 >Re: accessing newly-created files (From: "David Piasecki" <email@hidden>)

  • Prev by Date: Re: Attempting to match phone numbers in the Address Book
  • Next by Date: NSImageRGBColorTable crash
  • Previous by thread: Re: accessing newly-created files
  • Next by thread: Re: accessing newly-created files
  • Index(es):
    • Date
    • Thread