CString into Bytes
Im quite new to C++ and im trying to convert a CString into a byte - or get my byte out of the CString. I have tried doing it the C way via typecasting and that does not work. I have had a look at msdn and cant find a simlar example.
Could somebody give me some help.
You do realize that a CString holds more than one value, right? It's kinda like an array holding x-numbers of bytes. Basicly, you want to convert n*B to just 1*B, without even knowing n. To me, that sounds an awful lot like a hash-function! :) (I.e. completely irreversible)
I do realize I might be misinterpreting Your question. When You write "convert a CString into a byte", do you mean "into a byte", or do you mean that each cell should be one byte?
I haven't used MFC for many years, but I'm pretty sure this should work:
CString str = "Hello World";
char c = str;
Thanks for your input. It seems so easy now!!
CString has LPCSTR overloaded for this as well if my memory serves me right.