Re: NSFileHandle and serial ports?
Re: NSFileHandle and serial ports?
- Subject: Re: NSFileHandle and serial ports?
- From: Finlay Dobbie <email@hidden>
- Date: Thu, 13 Sep 2001 18:30:48 +0100
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