Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > Visual C++ 2005
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old November 30th, 2007, 11:51 AM
Registered User
Join Date: Nov 2007
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!

Old November 30th, 2007, 09:09 PM
Authorized User
Join Date: Jul 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts

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

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

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

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