|
union
{
char c[sizeof (int)];
int n;
} Convert;
char c = 250;
Convert.n = 0;
Convert.c[0] = c;
Then, in Convert.n you will get the proper value.
Good luck!
William
|
|
|
|
|
Geez
That's a really complicated way of doing that !
|
|
|
|
|
Chaa gia hai bhai!
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
|
hahahaha
What a solution yaar! Nice
Unique and innovative
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
...and you said what ?
|
|
|
|
|
i said "Chaa gia hai bhai" which means "Great job! brother!".
This is Urdu language idiom. It is used for a person who does something great.
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
thepersonof wrote: int a = int(c)
A cast is actually not necessary. You could accomplish the same with:
int a = c; because a char gets internally promoted to an int during such operations.
A char can hold values in the range -128 to 127, whereas an unsigned char can hold values in the range 0 to 255.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Hi there.
As the other replies have stated, you need to use the unsigned char for values above 127. To perform explicit conversions in C++, you should use the static_cast instead of the old C-Style casts.
<br />
unsigned char c = 250;<br />
int a = static_cast<int>(c);<br />
Cheers
|
|
|
|
|
abbiyr wrote: To perform explicit conversions in C++, you should use the static_cast instead of the old C-Style casts.
For integral types, this is not necessary.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Quite agree.
It is not necessary, the unsigned char will be cast correctly without it. I recommended it though, as it does explicity show the intentions of the developer.
|
|
|
|
|
When installing the VC6++ compiler on my PC (Win XP),
the installation process aborts with the message
"ODBC's SQLInstalldriver manager failed".
Can somebody please help ?
|
|
|
|
|
|
this did not help.
I even re-installed XP again,
the problem still exists.
|
|
|
|
|
have u tried installing the VC6 on a clean xp installation?
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Yes, that went OK.
There is something wrong with my PC, I want to find out wat it is.
|
|
|
|
|
Good luck
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
What are you installing that is related to ODBC and/or SQL? Try turning those options off and see if the problem subsides.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
It all started after installing an oracle database.
after this the comiler did not work anymore.
de-installing the database did not solve the problem.
Any support from the manufactorer was not givven.
"if we screw up your computer, that's your problem".
Any idea what to do ?
|
|
|
|
|
P.Pronk wrote: after this the comiler did not work anymore.
What stopped working?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
I want to set an icon for my app. I am not using MFC. Its plain Win32. How do I do that?
Aljechin Alexander
|
|
|
|
|
Use WM_SETICON .
Nibu thomas
Software Developer
|
|
|
|
|
I dont know how to use that. Can you show one code sample please?
Aljechin Alexander
|
|
|
|
|
|
I do not know how to use that. Can you kindly show some code sample of how to do it?
Aljechin Alexander
|
|
|
|