View Single Post
  #1 (permalink)  
Old November 30th, 2007, 11:51 AM
samiswt samiswt is offline
Registered User
 
Join Date: Nov 2007
Location: , , China.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to samiswt
Default Big challenge here! How to convert char* to char^?

[font = Book Antiqua]Hi, Folks!
I got a problem of pointer conversion. My compiler is VC++2005, so the definition of all pointers has to be ^, not * any more. But it was defined in most of available C++ APIs, e.g. GDAL. My question is how i can use pointers of them in VC++2005. [/font]

SortedList^ myList = gcnew SortedList;
char* myChar = poFeature->GetName(); //any char pointer;
char* myValue = ...;
myList->Add(myChar, myValue); // fail at compile-time, cannot cast char* to System::Object^;


even if i took safe_cast it couldn't work.
i was wondering if i can use * pointer properly in VC++2005, or i have to change my compiling command to /clr:oldSyntax?

any comments would be appreciate and welcome!

BEST REGARD!