How to convert to 'System::String ^'?

I could really do with some help converting to System::String ^.

I will be reading arguments into my program which are of type 'char*'
using:
int main(int argc, char* argv[])

However, I want to use the ping class (link below) which takes inputs of type 'System::String ^', and when I try to put argv[1] into the code like so:
PingReply ^ reply = pingSender->Send( argv[ 1 ], timeout, buffer, options );

I get the following error:
error C2664: 'System::Net::NetworkInformation::PingReply ^System::Net::NetworkInformation::Ping::Send(System::String ^,int,cli::array<Type> ^,System::Net::NetworkInformation::PingOptions ^)' : 
cannot convert parameter 1 from 'char *' to 'System::String ^'


Also, as this part of the code is within a separate function from the main function, and therefore doesn't have access to argv[] (correct me if I'm wrong) I have tried converting the arguments to a
vector as at compile time I do not know how many arguments will be passed in. I have declared vector<string> IPaddresses; as a global variable. And at the beginning of the main function
I put the arguments into this vector by:
1
2
3
for(int i=0; i<=(argc-1); i++){
		IPaddresses[i] = argv[i+1];
	}


Then when I try:
PingReply ^ reply = pingSender->Send( IPaddresses[1], timeout, buffer, options );

I get the following error:
error C2664: 'System::Net::NetworkInformation::PingReply
^System::Net::NetworkInformation::Ping::Send(System::String ^,int,cli::array<Type> ^,System::Net::NetworkInformation::PingOptions ^)' :
cannot convert parameter 1 from 'std::basic_string<_Elem,_Traits,_Ax>' to 'System::String ^'


Does anybody know the best way to convert to 'System::String ^'?
Or does anybody know a better way to do what I am trying to achieve?
Any advice whatsoever would be very much appreciated.

Thanks very much for your time,
Meerkat


here's a link to information on the ping class:
http://msdn.microsoft.com/en-us/library/system.net.networkinformation.ping.aspx
I'm pretty much just wanting to change the first example code slightly
closed account (1vRz3TCk)
Any advice whatsoever would be very much appreciated.

If you want to use the .net framework then using it fully i.e. don't try mixing native with managed code you will end up with a mess.
Thanks CodeMonkey, because some of the code I had written myself and others I was adapting from another source I had actually realised that I was mixing native with managed code ( I'm still very new at this).

And fair enough webJose, I get that it looks pretty idiotic. Thanks for taken the time to point me in the right direction though.
Your question is not idiotic at all. Your lack of effort in searching for an answer on the other hand.... hehe. Not idiotic, but lazy for sure. There are many questions already answered out there. We just need to look in the right places (meaning typing the correct keywords).
Topic archived. No new replies allowed.