FROM : Steve Cronin
DATE : Mon May 12 00:11:07 2008
Nick;
Thanks for the info, the deal is I don't have access to the source for
'initSomeSystem'.
So I can't answer your question, other than to point out what does
work..
I do know that ' #define kVersion "abc" ' creates a suitable string.
I'm trying to do the 'best' substitution I can with the fact that I
have an NSString and no access to the called method.
Hence my original question as the result of a #define x "123" being a
'char*'.
If that is true, then is the following the best solution?
#define kVERSION "abc"
NSString * partNumber = [[blah blah] moreBlah];
.....
const char * cPartNumber = [partNumber
cStringUsingEncoding:NSUTF8StringEncoding];
if( (p_flag = initSomeSystem (
kVERSION,
(char *) cPartNumber,
&errorCode))
== NULL) { ....
Thanks,
Steve
On May 11, 2008, at 12:59 PM, Nick Zitzmann wrote:
>
> On May 11, 2008, at 11:36 AM, Steve Cronin wrote:
>
>> Is this correct?
>> Is there a better way?
>
>
> It depends. Does the code take a real C string (char array), or does
> it take an Str63 or Str255 or something? If the latter, then you
> need to use CoreFoundation to get a Pascal string from the NSString.
>
> Nick Zitzmann
> <http://www.chronosnet.com/>
>
>
>
>
DATE : Mon May 12 00:11:07 2008
Nick;
Thanks for the info, the deal is I don't have access to the source for
'initSomeSystem'.
So I can't answer your question, other than to point out what does
work..
I do know that ' #define kVersion "abc" ' creates a suitable string.
I'm trying to do the 'best' substitution I can with the fact that I
have an NSString and no access to the called method.
Hence my original question as the result of a #define x "123" being a
'char*'.
If that is true, then is the following the best solution?
#define kVERSION "abc"
NSString * partNumber = [[blah blah] moreBlah];
.....
const char * cPartNumber = [partNumber
cStringUsingEncoding:NSUTF8StringEncoding];
if( (p_flag = initSomeSystem (
kVERSION,
(char *) cPartNumber,
&errorCode))
== NULL) { ....
Thanks,
Steve
On May 11, 2008, at 12:59 PM, Nick Zitzmann wrote:
>
> On May 11, 2008, at 11:36 AM, Steve Cronin wrote:
>
>> Is this correct?
>> Is there a better way?
>
>
> It depends. Does the code take a real C string (char array), or does
> it take an Str63 or Str255 or something? If the latter, then you
> need to use CoreFoundation to get a Pascal string from the NSString.
>
> Nick Zitzmann
> <http://www.chronosnet.com/>
>
>
>
>
| Related mails | Author | Date |
|---|---|---|
| Steve Cronin | May 11, 19:36 | |
| Nick Zitzmann | May 11, 19:59 | |
| Jens Alfke | May 11, 22:38 | |
| Steve Cronin | May 12, 00:11 | |
| Nick Zitzmann | May 12, 00:14 | |
| Scott Ribe | May 12, 19:41 |






Cocoa mail archive

