• 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
Converting C++ ostringStream (ostream) to ObjC's NSData
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Converting C++ ostringStream (ostream) to ObjC's NSData
      • From: Gen Kiyooka <email@hidden>
  • Prev by Date: Re: NSTableView & different columns
  • Next by Date: Re: Value transformer needed?
  • Previous by thread: Re: Value transformer needed?
  • Next by thread: Re: Converting C++ ostringStream (ostream) to ObjC's NSData
  • Index(es):
    • Date
    • Thread