No: internally when your application is running an integer is stored in hexadecimal format (well actually if you go low enough it is stored in binary format).
To do this as part of a Windows Form Application I would have a textbox in which the user inputs the string: then I would do something like:
String^ inputString = inputTextBox->Text;
if (inputString != nullptr) { // Allow for really large values Int64 value;
Hello, Jonathan, isn't an integer in decimal format Secondly, I am not writing a console application, I am writing a Windows Forms one, and what I really meant was that I created an app in which the user types a string and gets the ASCII value of his string and then I will be converted to it's Hexa equivilant.
Hi: Gal an int already is in hexadecimal format: think about it . But I presume that what you want to do is print it out in hexadecimal format. There are several ways to do this: in regular C and C++ I tend to use:
Changing an int to a hexadecimal format
salmanpirzada
To do this as part of a Windows Form Application I would have a textbox in which the user inputs the string: then I would do something like:
String^ inputString = inputTextBox->Text;
if (inputString != nullptr)
{
// Allow for really large values
Int64 value;
try
{
value = Int64::Parse(inputString);
}
catch (OverflowException^ e)
{
// ...
}
catch (FormatException^ e)
{
// ...
}
String^ outputValue = value.ToString("x");
outputTextBox->Text = outputValue;
}
schmaltzkj
Rod Fraga
int i = 42;
printf("i = 0x%08x\n", i);
In C++/CLI I would use:
Console::WriteLine("i = 0x{0}", i.ToString("x8"));
I never did take the time to work out how to do this with IO streams other than the "hacky":
std::cout << "i = 0x" << reinterpret_cast<void*>(i) << std::endl;
Paulvo