cannot convert from 'char *' to 'unsigned short *'
-
Hi Friends, I am doing a UNICODE project, Here i am using wchar_t * variable and i am taking name of the file from CString.GetBuffer(). Here i am getting the :confused:error C2440: 'initializing' : cannot convert from 'char *' to 'unsigned short *' Please help me. Its urgent....
-
Hi Friends, I am doing a UNICODE project, Here i am using wchar_t * variable and i am taking name of the file from CString.GetBuffer(). Here i am getting the :confused:error C2440: 'initializing' : cannot convert from 'char *' to 'unsigned short *' Please help me. Its urgent....
First, never ever use GetBuffer without having read the documentation. CString has casting operator so that you don't have to use GetBuffer. You should only use this function if you want access to the internal buffer of the CString. Read the doc carefully if you don't want nasty surprises in your code. You should prefer the use of TCHAR instead of char or wchar. This way, everything is either char or wchar depending on the UNICODE settings and you don't have to worry about conversions. Now, maybe you'll still need a conversion: what are you doing with this wchar string ?
Cédric Moonen Software developer
Charting control [v1.2] -
Hi Friends, I am doing a UNICODE project, Here i am using wchar_t * variable and i am taking name of the file from CString.GetBuffer(). Here i am getting the :confused:error C2440: 'initializing' : cannot convert from 'char *' to 'unsigned short *' Please help me. Its urgent....
santhoshv84 wrote:
I am doing a UNICODE project,
Sure?
santhoshv84 wrote:
Here i am getting the error C2440: 'initializing' : cannot convert from 'char *' to 'unsigned short *'
Probably you aren't doing a UNICODE build. check if the
_UNICODE
preprocessor symbol is defined for your project. BTW: probably you don't need either to accessCString
internal buffer, hence avoid to callGetBuffer
method. BTW 2: maybe better to use generic text data, i.e.TCHAR
insted ofw_char
. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.