Click here to Skip to main content
15,911,786 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: problem in communication with UDP Pin
Mark Salsbery23-Jul-07 5:02
Mark Salsbery23-Jul-07 5:02 
QuestionUTF problem Pin
Suneet.0319-Jul-07 21:52
Suneet.0319-Jul-07 21:52 
AnswerRe: UTF problem Pin
Cedric Moonen19-Jul-07 22:15
Cedric Moonen19-Jul-07 22:15 
GeneralRe: UTF problem Pin
Matthew Faithfull19-Jul-07 22:18
Matthew Faithfull19-Jul-07 22:18 
GeneralRe: UTF problem Pin
Suneet.0319-Jul-07 22:26
Suneet.0319-Jul-07 22:26 
GeneralRe: UTF problem Pin
Matthew Faithfull19-Jul-07 23:00
Matthew Faithfull19-Jul-07 23:00 
GeneralRe: UTF problem Pin
Suneet.0319-Jul-07 23:22
Suneet.0319-Jul-07 23:22 
GeneralRe: UTF problem Pin
Matthew Faithfull20-Jul-07 0:34
Matthew Faithfull20-Jul-07 0:34 
Programming for UNICODE is a big topic and you may want to do some research before embarking on a rewrite if your project. However here's a starter

strcpy only handles 8 bit char(s) as you know
wcscpy only handles 16 bit WCHAR(s)
_mbscpy handles multibyte characters (unsigned long apparently)

see here[^]

_tcscpy is really a macro which turns into wcscpy if your build your project for UNICODE, _mbscpy if you build with _MBCS defined and strcpy if you build your project without UNICODE or _MBCS defined.
Similarly TCHAR becomes WCHAR or char or presumably unsigned long.

Personally I would stay clear of all the _MBCS stuff and stick with 2 builds, One with UNICODE defined and one without for the same source. Try to use the _t functions, like _tcslen, everywhere and remember to wrap your string constants with the _T macro e.g. _T("Some Text"). Most if not all your code should work in both builds. Any features that only work in UNICODE, like dealing with Hindi, might get excluded from the non UNICODE build with #ifdef UNICODE.

Unfortunately things are not quite that simple. Microsoft now recommend we all use Safe String functions, see here[^] and all the various _s extended variants of the normal C Library functions with extra parameters to enable buffer overrun protection.

I hope this is enough to give you a start. If it looks like a mess I'm afraid it is and the only way through is really to pick a standard way of doing things and stick to it rigerously. Of course it helps if you pick the right way for your application and that can be hard.



Nothing is exactly what it seems but everything with seems can be unpicked.

GeneralRe: UTF problem Pin
Suneet.0322-Jul-07 23:05
Suneet.0322-Jul-07 23:05 
GeneralRe: UTF problem Pin
Matthew Faithfull23-Jul-07 3:20
Matthew Faithfull23-Jul-07 3:20 
Questionusing MatchDocTypa() in mfc appln.. Pin
mirraa19-Jul-07 21:46
mirraa19-Jul-07 21:46 
QuestionPostMessage() inside MidiInProc() Pin
rp_suman19-Jul-07 21:27
rp_suman19-Jul-07 21:27 
AnswerRe: PostMessage() inside MidiInProc() Pin
Shouvik Das19-Jul-07 21:45
Shouvik Das19-Jul-07 21:45 
GeneralRe: PostMessage() inside MidiInProc() Pin
rp_suman19-Jul-07 22:20
rp_suman19-Jul-07 22:20 
AnswerRe: PostMessage() inside MidiInProc() Pin
tanvon malik19-Jul-07 21:48
tanvon malik19-Jul-07 21:48 
GeneralRe: PostMessage() inside MidiInProc() Pin
rp_suman19-Jul-07 22:14
rp_suman19-Jul-07 22:14 
QuestionVC++ Q/A Pin
Jhony george19-Jul-07 21:01
Jhony george19-Jul-07 21:01 
AnswerRe: VC++ Q/A Pin
Shouvik Das19-Jul-07 21:32
Shouvik Das19-Jul-07 21:32 
AnswerRe: VC++ Q/A Pin
Jonathan [Darka]19-Jul-07 21:59
professionalJonathan [Darka]19-Jul-07 21:59 
GeneralRe: VC++ Q/A Pin
Jhony george19-Jul-07 22:13
Jhony george19-Jul-07 22:13 
AnswerRe: VC++ Q/A Pin
Hamid_RT31-Jul-07 19:22
Hamid_RT31-Jul-07 19:22 
QuestionProblem in Client Server Programming Pin
Abhijit A19-Jul-07 20:56
Abhijit A19-Jul-07 20:56 
AnswerRe: Problem in Client Server Programming Pin
led mike20-Jul-07 4:44
led mike20-Jul-07 4:44 
QuestiongetSubItemRect...?? Pin
sheshidar19-Jul-07 20:45
sheshidar19-Jul-07 20:45 
QuestionRe: getSubItemRect...?? Pin
David Crow20-Jul-07 3:31
David Crow20-Jul-07 3:31 

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.