Hi! what's the fastest way to convert a CString into an int?
thx.
Hi! what's the fastest way to convert a CString into an int?
thx.
GameJolt: https://gamejolt.com/@KasunL
Game Development Youtube: https://is.gd/XyhYoP
Amateur IT Blog: http://everything-geeky.blogspot.com/
(and, sorry for my amateur English)
Do you have a particular need for 'fast as possible', or will one of the normal ways work?
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
hi,
normal ways will work. i just want to know if there is a way to convert CString to an int without transferring the value into a c-style string 1st and using atoi().
thx.
GameJolt: https://gamejolt.com/@KasunL
Game Development Youtube: https://is.gd/XyhYoP
Amateur IT Blog: http://everything-geeky.blogspot.com/
(and, sorry for my amateur English)
atoi() the CString is what I do.
"Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
Friedrich Nietzsche
"I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
George Best
"If you are going through hell....keep going."
Winston Churchill
If you are using MFC/ATL there are several conversion functions provided inside of ATL. Of course using these forces your app to rely on them. Look them up in your help file under ATL or under CString. I think CString has a link in the help file that leads to the right page.
Other than that and what has already been suggested there really is no elegant way to convert a CString. CString is a very nice class but unfortunately it is closely tied into MFC and thus outside of that becomes a pain in the arse to use.