Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > Visual C++ 2005
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Visual C++ 2005 For discussion of Visual C++ 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual C++ 2005 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 30th, 2007, 11:51 AM
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!
  #2 (permalink)  
Old November 30th, 2007, 09:09 PM
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You can still use char* in C++/CLI.

Also, in most cases you should just use System::String^ instead.


 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert byte[] to char[] mega .NET Framework 2.0 1 December 29th, 2006 11:29 AM
Invalid conversion from 'char*' to 'char' deuxmio C++ Programming 3 December 8th, 2006 07:56 AM
Convert a char to int!!!!?? vtvb C++ Programming 6 March 18th, 2006 05:51 AM
Could not convert to environment national char... saravananedu Oracle 0 June 24th, 2004 05:49 AM
convert char to int does not work yasaman C# 1 August 6th, 2003 10:39 AM



All times are GMT -4. The time now is 03:05 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.