Converting C++ ostringStream (ostream) to ObjC's NSData
Converting C++ ostringStream (ostream) to ObjC's NSData
- Subject: Converting C++ ostringStream (ostream) to ObjC's NSData
- From: "Frederick C. Lee" <email@hidden>
- Date: Sat, 2 Jul 2005 21:48:53 -0700
Greetings:
How can I convert a C++ data stream (ostringstream or
stringstream) to ObjC's NSData?
I'm attempting to call a C++ routine from an ObjC routine:
---------------------------------------------
Inside ObjC calling routine:
Foo *myCPlusPlusObj;
myCPlusPlusObj=new Foo();
...
NSData *vecData = [NSData dataWithData:myCPlusPlusObj->getVec()];
...
---------------------------------------------
The called C++ routine is:
void *Foo::getVec(void) {
ostringstream dataStream;
....
return datastream;
}
The return value is a void * pointer. The conversion doesn't work.
The compiler can't convert a void * ptr to NSData.
Or, returning a iostream *, I get a runtime Signal 11 error: " Obj_C
++ has exited due to signal 11 (SIGSEGV)."
Any ideas?
Regards,
Ric.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden