How can convert a char array to CString?
-
Hi All, How can i convert a char array into CString? I have one array like this char charr[1000]; .... drwFile.Read(charr,500); //reading some characters from the file CString str; how to store the charr array in to str? i m try this CString str(charr); but when i display a message box with str value its display only first character of charr. please help me for this. thanks in advance.
-
Hi All, How can i convert a char array into CString? I have one array like this char charr[1000]; .... drwFile.Read(charr,500); //reading some characters from the file CString str; how to store the charr array in to str? i m try this CString str(charr); but when i display a message box with str value its display only first character of charr. please help me for this. thanks in advance.
-
Hi All, How can i convert a char array into CString? I have one array like this char charr[1000]; .... drwFile.Read(charr,500); //reading some characters from the file CString str; how to store the charr array in to str? i m try this CString str(charr); but when i display a message box with str value its display only first character of charr. please help me for this. thanks in advance.
Check the encoding used in file.
-
Hi All, How can i convert a char array into CString? I have one array like this char charr[1000]; .... drwFile.Read(charr,500); //reading some characters from the file CString str; how to store the charr array in to str? i m try this CString str(charr); but when i display a message box with str value its display only first character of charr. please help me for this. thanks in advance.
As already suggested by Rejeesh.T.S if your text file contains wide characters and your application doesn't use the
UNICODE
charset then the output posted is the expected result. Hence either make aUNICODE
build or useMFC/ATL
conversion macros in you project. :)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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Hi All, How can i convert a char array into CString? I have one array like this char charr[1000]; .... drwFile.Read(charr,500); //reading some characters from the file CString str; how to store the charr array in to str? i m try this CString str(charr); but when i display a message box with str value its display only first character of charr. please help me for this. thanks in advance.
You're probably not using a UNICODE build. You could either change
Project -> Properties -> Configuration Properties -> General -> Character Set to Use Unicode Character Set
or try usingCStringW
andMessageBoxW
.«_Superman_» _I love work. It gives me something to do between weekends.