CSting ASCII to decimal Number
-
how to convert an CString ASCII to decimal number? For example, an "A" alphabet in ASCII table is 65 in decimal number, how can i convert the alphabet to an integer as 65. I get data from serial port MSCOMM
VARIANT in_dat; in_dat = m_comm.GetInput(); CString strInput(in_dat.bstrVal);
I want conver strInput alphabet to decimal. i'm sorry, I can't speak english fluently. thx -
how to convert an CString ASCII to decimal number? For example, an "A" alphabet in ASCII table is 65 in decimal number, how can i convert the alphabet to an integer as 65. I get data from serial port MSCOMM
VARIANT in_dat; in_dat = m_comm.GetInput(); CString strInput(in_dat.bstrVal);
I want conver strInput alphabet to decimal. i'm sorry, I can't speak english fluently. thxatoi,atof should help you You can also use variant type changing functions Convert string to double:
CComVariant myVar; double result; // myVar has some double value in string format say 123.345 if(myVar.ChangeType(VT_R8)==S_OK) result=myVar.dblVal;
You should read this[^] link to understand how this can be done in more than one way.You talk about Being HUMAN. I have it in my name AnsHUMAN
modified on Tuesday, July 19, 2011 12:26 AM
-
how to convert an CString ASCII to decimal number? For example, an "A" alphabet in ASCII table is 65 in decimal number, how can i convert the alphabet to an integer as 65. I get data from serial port MSCOMM
VARIANT in_dat; in_dat = m_comm.GetInput(); CString strInput(in_dat.bstrVal);
I want conver strInput alphabet to decimal. i'm sorry, I can't speak english fluently. thxAssuming you are reading each byte one at a time, then the values are already integers. A byte containing the character 'A' is the same as the value 65 decimal. There is no conversion necessary, just accept the data as integer, not string.
The best things in life are not things.
-
Assuming you are reading each byte one at a time, then the values are already integers. A byte containing the character 'A' is the same as the value 65 decimal. There is no conversion necessary, just accept the data as integer, not string.
The best things in life are not things.