• 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: char Array to NSString to cString?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: char Array to NSString to cString?


  • Subject: Re: char Array to NSString to cString?
  • From: Vince Ackerman <email@hidden>
  • Date: Fri, 1 Jun 2007 20:25:34 -0700


On Jun 1, 2007, at 19:41, Vince Ackerman wrote:

Thanks all,

This presents a problem for me since I was using some third party serial port classes (AMSerial, if you're familiar) to do the serial port stuff. It uses NSStrings in all it's write methods, which is why I was having such a problem.

I guess I could modify his code, or just use the serial port samples Apple has posted. I thought there'd be an easier way, as I don't know much about serial I/O and termios structs. Guess I'll have to learn : )

Thanks for the help though.

Vince

On Jun 1, 2007, at 10:18, Tomas Franzén wrote:


On 1 jun 2007, at 17.15, Vince Ackerman wrote:

I'm having a bit of trouble trying to convert an array of 7 (unsigned char) to a NSString. I need to pass this array of hex values to another object that is expecting an NSString that it will convert to a C string and send it out the serial port

(unsigned char) myArray[7];

Hi,
Unless I've missed something, can't you just write it directly, instead of going through NSString (or NSData)?


write(fileDescriptor, myArray, sizeof(myArray));

Tomas Franzén
Lighthead Software
http://www.lightheadsw.com/



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >char Array to NSString to cString? (From: Vince Ackerman <email@hidden>)
 >Re: char Array to NSString to cString? (From: Tomas Franzén <email@hidden>)

  • Prev by Date: Re: NSMachPort vs. NSMessagePort
  • Next by Date: Re: SIGTRAP in NSURLConnection
  • Previous by thread: Re: char Array to NSString to cString?
  • Next by thread: NSSegmentedCell in table column
  • Index(es):
    • Date
    • Thread