Click here to Skip to main content
15,899,126 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionhow to type cast from CString to int [modified] Pin
yogendra kaushik14-Jun-06 19:58
yogendra kaushik14-Jun-06 19:58 
AnswerRe: how to type cast from CString to int Pin
Laxman Auti14-Jun-06 20:02
Laxman Auti14-Jun-06 20:02 
GeneralRe: how to type cast from CString to int Pin
Stephen Hewitt14-Jun-06 20:54
Stephen Hewitt14-Jun-06 20:54 
GeneralRe: how to type cast from CString to int Pin
Laxman Auti14-Jun-06 22:43
Laxman Auti14-Jun-06 22:43 
AnswerRe: how to type cast from CString to int Pin
Amar Sutar14-Jun-06 20:03
Amar Sutar14-Jun-06 20:03 
AnswerRe: how to type cast from CString to int Pin
NiceNaidu14-Jun-06 20:10
NiceNaidu14-Jun-06 20:10 
AnswerRe: how to type cast from CString to int Pin
Hamid_RT14-Jun-06 20:28
Hamid_RT14-Jun-06 20:28 
AnswerRe: how to type cast from CString to int Pin
John R. Shaw15-Jun-06 1:56
John R. Shaw15-Jun-06 1:56 
You have recieved several answers to your question and they all show you how to convert a string to integer. Take note that this is not type casting, it is conversion from one form to another. This is important because you could type cast a string to an integer value but the value would not be the value entered in the string. It would take the individule byes and assume they are parts of the final number you are seeking.

char str = "AB"; // 'A' = 0x41, 'B' = 0x42
short n = (short*)(str); // n = 0x4241 = 16961

If you are wondering about the reversal of the numbers durring the type casting, then you need to go look up big endian and little endian on the Web.

INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
QuestionWindows Service & CDatabase Pin
vikramlinux14-Jun-06 19:44
vikramlinux14-Jun-06 19:44 
AnswerRe: Windows Service & CDatabase Pin
NiceNaidu14-Jun-06 20:18
NiceNaidu14-Jun-06 20:18 
AnswerRe: Windows Service & CDatabase Pin
Milton Karimbekallil14-Jun-06 21:42
Milton Karimbekallil14-Jun-06 21:42 
GeneralRe: Windows Service & CDatabase Pin
vikramlinux14-Jun-06 22:55
vikramlinux14-Jun-06 22:55 
Questionflex and bison with visual c++ [modified] Pin
c0714-Jun-06 19:37
c0714-Jun-06 19:37 
AnswerRe: flex and bison with visual c++ Pin
Hamid_RT14-Jun-06 19:44
Hamid_RT14-Jun-06 19:44 
GeneralRe: flex and bison with visual c++ Pin
c0714-Jun-06 20:05
c0714-Jun-06 20:05 
GeneralRe: flex and bison with visual c++ Pin
David Crow15-Jun-06 2:52
David Crow15-Jun-06 2:52 
QuestionWord Automation Pin
KongHL14-Jun-06 19:14
KongHL14-Jun-06 19:14 
AnswerRe: Word Automation Pin
Milton Karimbekallil15-Jun-06 1:07
Milton Karimbekallil15-Jun-06 1:07 
QuestionI have a promblem with dialogbar Pin
secddos14-Jun-06 19:09
secddos14-Jun-06 19:09 
AnswerRe: I have a promblem with dialogbar Pin
_AnsHUMAN_ 14-Jun-06 19:12
_AnsHUMAN_ 14-Jun-06 19:12 
Questioncheck for free ports Pin
shuchigo_jane14-Jun-06 19:01
shuchigo_jane14-Jun-06 19:01 
AnswerRe: check for free ports Pin
Laxman Auti14-Jun-06 19:42
Laxman Auti14-Jun-06 19:42 
GeneralRe: check for free ports Pin
shuchigo_jane14-Jun-06 19:50
shuchigo_jane14-Jun-06 19:50 
GeneralRe: check for free ports Pin
Laxman Auti14-Jun-06 19:59
Laxman Auti14-Jun-06 19:59 
Questionpassing a CString from one class to another [modified] Pin
locoone14-Jun-06 18:23
locoone14-Jun-06 18:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.