• 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: newbie defines and NSString problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: newbie defines and NSString problem


  • Subject: Re: newbie defines and NSString problem
  • From: Ken Hawkins <email@hidden>
  • Date: Thu, 11 Mar 2004 09:22:41 -0800

thanks for all the help. does this look like the LONG way around to
write data to a file to anyone else?

NSString *str = COPYRIGHT_MARKER;
unichar *buff;
[str getCharacters:buff];

NSData *data = [NSData dataWithBytes:buff:[str length]];

if(data == nil)
{
[log toLog:self:kLOG_ERROR:@"writeCopyright failed could not retrieve
a copyright marker"];
[log toLog:self:kLOG_OBJECT_DEBUG:@"-writeCopyright exit-"];
return NO;
}

/* write the COPYRIGHT_MARKER */
[pfhBMD writeData:data];


btw 'pfhBMD' is a NSFileHandle pointer type.

and one more ? is there a nice OutputStream available? i only see
NSOutputStream that appears to write only uint8_t * information. are
there any out there that handle the formating of data types so i can do
things like writeInt, writeBOOL, etc?

thanks again,
ken;

On Mar 11, 2004, at 8:35 AM, String wrote:

> Try
>
> #define FOO CFSTR("bar")
>
>
> On Mar 11, 2004, at 10:12 AM, Ken Hawkins wrote:
>
>> let me dive right in as i'm sure it is an easy one.
>>
>> i have a defines.h:
>>
>> #define FOO "bar"
>>
>> annd now i include it in main.c (example)
>>
>> where i try to
>>
>> NSString *str = [NSString stringWith???: FOO];
>>
>> i inserted the '???' because i have tried a number of routines from:
>>
>> stringWith Format:@"%s":FOO];
>> stringWith Format:@"%@":FOO];
>> stringWith Format:@"%s":CFSTR(FOO)];
>>
>> it always returns me an erro before token ";"
>>
>> if i take out the 'FOO' and insert any old @"bar" it will will work.
>>
>> what am i easily overlooking?
>>
>> thanks,
>> ken; _______________________________________________
>> cocoa-dev mailing list | email@hidden
>> Help/Unsubscribe/Archives:
>> http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>> Do not post admin requests to the list. They will be ignored.
> _______________________________________________
> cocoa-dev mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/cocoa-dev
> Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: newbie defines and NSString problem
      • From: Ondra Cada <email@hidden>
References: 
 >newbie defines and NSString problem (From: Ken Hawkins <email@hidden>)
 >Re: newbie defines and NSString problem (From: String <email@hidden>)

  • Prev by Date: Re: Wisdom of overriding isEqual:
  • Next by Date: Re: Updating multiple NSViews[solved]
  • Previous by thread: Re: newbie defines and NSString problem
  • Next by thread: Re: newbie defines and NSString problem
  • Index(es):
    • Date
    • Thread