Creating an NSString from a data buffer
Creating an NSString from a data buffer
- Subject: Creating an NSString from a data buffer
- From: email@hidden
- Date: Tue, 17 Dec 2002 20:47:56 -0800 (PST)
Hello!
Sorry for this newbie question, but I have been around
for quite a while, and I think I tried everything but
the
right thing.
I am building an object that can read / write a file
format that contains strings and binary codes.
At one point in the program, I have a buffer, which is
valid and contains the data I want. I want to extract an
unicode string from it. After having found the begin
and end positions of the string inside of the data
buffer, I would likw to create an NSString from it.
------
char * buffer; // My data buffer
NSString * S; // One NSString into which I want to
store data
char *begin;
char *end;
// At this pont, begin and end have been found and have
// the right values (end > begin)
// I tried, among many other things:
S = [NSString stringWithCharacters:begin
length:(end-begin)];
------
I tried the same, but with an alloc before calling
stringWithCharacters, etc...
Project builder keeps telling me that this method
(stringWithCharacters) cannot be found, although it
is in NSString.h:
+[NSString stringWithCharacters::]: selector not
recognized
Do I have to specify that I want to use some protocol?
Or some category?
I also thought I could maybe put all my data into an
NSString, maybe mutable, but my data does not correspond
to a string encoding...
Thanks for any help.
Pascal
_______________________________________________
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.