Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

System::String^ to Hexadecimal representation, help needed

Tags:

visual-c++

I need to convert String^ type to hexadecimal string representation. I'm coding on MSVC++'05. Need help with the algorithm, have already tried the strtol function and it is not outputting the result i'm expecting.

String^ str = "993";

I wan str to be converted to hexadecimal which is 0x03E1, how do i go about do this? Any help or directions is greatly appreciated. Thanks in advance.

like image 668
f0rfun Avatar asked May 03 '26 11:05

f0rfun


1 Answers

Transforming it into a hexadecimal is in the display portion of it.

String^ str = "993";
int value;
if(!Int32::TryParse(str,value))
{
    Console::WriteLine("Failed, exiting");
    return -1;
}
Console::WriteLine(value.ToString("X"));

This indicates the output should be hex -----^^^

like image 74
jonsca Avatar answered May 05 '26 03:05

jonsca



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!