Click here to Skip to main content
15,917,618 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionWhy is pointer a compound type, not a fundamental type? Pin
sawerr7-Jul-12 22:06
sawerr7-Jul-12 22:06 
AnswerRe: Why is pointer a compound type, not a fundamental type? Pin
Richard MacCutchan7-Jul-12 23:20
mveRichard MacCutchan7-Jul-12 23:20 
AnswerRe: Why is pointer a compound type, not a fundamental type? Pin
«_Superman_»8-Jul-12 3:20
professional«_Superman_»8-Jul-12 3:20 
AnswerRe: Why is pointer a compound type, not a fundamental type? Pin
fat_boy8-Jul-12 4:03
fat_boy8-Jul-12 4:03 
QuestionHow to receive data using dynamic array in recv api()? Pin
vanithavadivel7-Jul-12 0:13
vanithavadivel7-Jul-12 0:13 
AnswerRe: How to receive data using dynamic array in recv api()? Pin
Richard MacCutchan7-Jul-12 0:55
mveRichard MacCutchan7-Jul-12 0:55 
AnswerRe: How to receive data using dynamic array in recv()? Pin
Software_Developer7-Jul-12 23:28
Software_Developer7-Jul-12 23:28 
QuestionC programming question Pin
Kotiexalter6-Jul-12 18:05
Kotiexalter6-Jul-12 18:05 
AnswerRe: C programming question Pin
Richard MacCutchan6-Jul-12 21:09
mveRichard MacCutchan6-Jul-12 21:09 
AnswerRe: C programming question Pin
Code-o-mat6-Jul-12 22:45
Code-o-mat6-Jul-12 22:45 
GeneralRe: C programming question Pin
Richard MacCutchan7-Jul-12 0:48
mveRichard MacCutchan7-Jul-12 0:48 
GeneralRe: C programming question Pin
Code-o-mat7-Jul-12 9:04
Code-o-mat7-Jul-12 9:04 
GeneralRe: C programming question Pin
Richard Andrew x647-Jul-12 10:55
professionalRichard Andrew x647-Jul-12 10:55 
GeneralRe: C programming question Pin
BCN-1637-Jul-12 16:24
BCN-1637-Jul-12 16:24 
GeneralRe: C programming question Pin
Code-o-mat7-Jul-12 23:20
Code-o-mat7-Jul-12 23:20 
AnswerRe: C programming question Pin
CPallini8-Jul-12 9:45
mveCPallini8-Jul-12 9:45 
JokeRe: C programming question Pin
Albert Holguin8-Jul-12 17:12
professionalAlbert Holguin8-Jul-12 17:12 
QuestionSocket connection problem Pin
ForNow6-Jul-12 3:08
ForNow6-Jul-12 3:08 
AnswerRe: Socket connection problem Pin
Albert Holguin6-Jul-12 4:15
professionalAlbert Holguin6-Jul-12 4:15 
GeneralRe: Socket connection problem Pin
ForNow6-Jul-12 6:57
ForNow6-Jul-12 6:57 
AnswerRe: Socket connection problem Pin
fat_boy6-Jul-12 5:53
fat_boy6-Jul-12 5:53 
QuestionReading Buffer of unicode and ansi character Pin
john56326-Jul-12 0:06
john56326-Jul-12 0:06 
GeneralRe: Reading Buffer of unicode and ansi character Pin
Jochen Arndt6-Jul-12 0:22
professionalJochen Arndt6-Jul-12 0:22 
GeneralRe: Reading Buffer of unicode and ansi character Pin
john56326-Jul-12 0:39
john56326-Jul-12 0:39 
AnswerRe: Reading Buffer of unicode and ansi character Pin
Jochen Arndt6-Jul-12 0:56
professionalJochen Arndt6-Jul-12 0:56 
Wide char strings stored in files usually begin with a BOM (Byte Order Mark)[^].

If there is no BOM in your case, use the ANSI strlen() function and compare the result with the buffer length without NULL bytes. If it matches, the string is ANSI or UTF-8. If not, it is probably a wide char string. For Microsoft Unicode (UTF-16LE), this can be verified by comparing the return value of wcslen() with the buffer length (multiply returned length by two / sizeof(wchar_t)).

This solution requires that the string in the buffer is NULL terminated. If not, create a new buffer with length + 2, copy the data and append two NULL bytes (two bytes to have a valid terminated wide char string).

If the strings in the buffer are NULL terminated, you may also look for two NULL bytes at the end of UTF-16 strings.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.