• 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: 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


  • Follow-Ups:
    • Re: NSFileHandle and serial ports?
      • From: Jeffrey J Barbose <email@hidden>
References: 
 >NSFileHandle and serial ports? (From: Jeffrey J Barbose <email@hidden>)

  • Prev by Date: Re: GTK+ Quartz Project Started
  • Next by Date: Re: NSFileHandle and serial ports?
  • Previous by thread: NSFileHandle and serial ports?
  • Next by thread: Re: NSFileHandle and serial ports?
  • Index(es):
    • Date
    • Thread