• 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: NSFileHandle and serial ports?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSFileHandle and serial ports?


  • Subject: Re: NSFileHandle and serial ports?
  • From: Jeffrey J Barbose <email@hidden>
  • Date: Thu, 13 Sep 2001 10:44:32 -0700

i read the documentation, and saw that filedescriptors were ok..but
i've only seen NSFileHandle used for files and for TCP sockets..which
is why i asked about serial.

I'll give it a go and see what i can find out from that. thanks!

jeff


At 18.30 +0100 01/9/13, Finlay Dobbie wrote:
>On Thursday, September 13, 2001, at 05:33 pm, Jeffrey J Barbose wrote:
>
>>Is it a natural fit to take the fileDescriptor returned by the BSD
>>layer (as provided via IOKit and the Keyspan drivers) and hand it
>>off to NSFileHandle for reading and writing to/from a serial port?
>>
>>It sure would make life a WHOLE lot easier.
>
>file:///Developer/Documentation/Cocoa/Reference/Foundation/ObjC_classic/Classes/
>NSFileHandle.html
>
>initWithFileDescriptor:
>
><Attachment missing>
>
>Returns an NSFileHandle initialized with the file descriptor
>fileDescriptor. You can create an NSFileHandle for a socket by using
>the result of a socket call as fileDescriptor. The object creating
>an NSFileHandle using this method owns fileDescriptor and is
>responsible for its disposition.
>
>So something like this should work:
>
>FILE* myFile;
>NSFileHandle *myFileHandle;
>
>// do something to make aFoo non-null
>
>myFileHandle = [[NSFileHandle alloc] initWithFileDescriptor:fileno(myFile)];
>
>Hope that helps,
>
> -- Finlay
>
>
> On Thursday, September 13, 2001, at 05:33 pm, Jeffrey J Barbose wrote:
>
>>Is it a natural fit to take the fileDescriptor returned by the BSD
>>layer (as provided via IOKit and the Keyspan drivers) and hand it
>>off to NSFileHandle for reading and writing to/from a serial port?
>>
>>It sure would make life a WHOLE lot easier.
>
>file:///Developer/Documentation/Cocoa/Reference/Foundation/ObjC_classic/Classes/NSFileHandle.html
>
>initWithFileDescriptor:
>
>
>Content-Disposition: inline;
> filename="Table.pdf"
>Content-Type: application/pdf;
> name="Table.pdf";
> x-unix-mode=0666
>
>Attachment converted: Mac OS X:Table.pdf (PDF /CARO) (000244B6)
>
>
>Returns an NSFileHandle initialized with the file descriptor
>fileDescriptor. You can create an NSFileHandle for a socket by using
>the result of a socket call as fileDescriptor. The object creating
>an NSFileHandle using this method owns fileDescriptor and is
>responsible for its disposition.
>
>So something like this should work:
>
>FILE* myFile;
>NSFileHandle *myFileHandle;
>
>// do something to make aFoo non-null
>
>myFileHandle = [[NSFileHandle alloc] initWithFileDescriptor:fileno(myFile)];
>
>Hope that helps,
>
> -- Finlay


  • Follow-Ups:
    • Re: NSFileHandle and serial ports?
      • From: Ondra Cada <email@hidden>
References: 
 >Re: NSFileHandle and serial ports? (From: Finlay Dobbie <email@hidden>)

  • Prev by Date: Re: NSFileHandle and serial ports?
  • Next by Date: Developer question on OS X Beta
  • Previous by thread: Re: NSFileHandle and serial ports?
  • Next by thread: Re: NSFileHandle and serial ports?
  • Index(es):
    • Date
    • Thread