Easy question, but im stuck. :)
-
How do I get the contents of CString m_strData into BYTE* m_pData? I have a edit box that has a member variable of m_strData, and I need to get the string into the m_pData variable. Thanks :)
-
How do I get the contents of CString m_strData into BYTE* m_pData? I have a edit box that has a member variable of m_strData, and I need to get the string into the m_pData variable. Thanks :)
What Martin suggested sets m_pData to point to m_strData. I interpret your question as...You want to copy the contents of m_strData to m_pData(which is already allocated). If so you could use memcpy or strcpy and cast m_pData to a char* Gary Kirkham A working Program is one that has only unobserved bugs
-
try this one: CString strTemp = "Hello World"; BYTE* pByte = (BYTE*) (LPCTSTR) strTemp; MS
NO!!! This is dangerous! You need to do this: CString strTemp = "Hello World"; BYTE* pByte = (BYTE*) strTemp.LockBuffer(); and when pByte is not needed anymore: strTemp.UnlockBuffer(); Never cast away the const-ness of a pointer... Concussus surgo. When struck I rise.
-
What Martin suggested sets m_pData to point to m_strData. I interpret your question as...You want to copy the contents of m_strData to m_pData(which is already allocated). If so you could use memcpy or strcpy and cast m_pData to a char* Gary Kirkham A working Program is one that has only unobserved bugs