Page 1 of 2
Bunch of errors

Posted:
Aug 1, 2003 @ 10:41pm
by Datalore

Posted:
Aug 1, 2003 @ 10:51pm
by simonjacobs
I think your function calls are expecting strings in multi byte format on the ppc instead of single byte on the desktop. Either try:
L"text" instead of "text" or convert them. There is a function to convert which I dont remember off hand, search for string conversion in the docs.
WideCharToMultiByte or something.

Posted:
Aug 1, 2003 @ 11:26pm
by Kzinti

Posted:
Aug 2, 2003 @ 1:28am
by fzammetti
I used to have a problem with this, until I learned the "pattern"... Always use the TEXT() macro, and then only use functions defined in TCHAR.h, as Thierry said (hint: when in VC++ or I think eVC++ as well, look up the function you want in the docs, say swprintf or printf, and scroll down, there is usually a section labeled Generic Text String Mappings, and it shows the TCHAR.h function name there... just use that!). Do these things and you should be able to compile for the desktop and PPC's without any problems.

Posted:
Aug 2, 2003 @ 3:51am
by Datalore

Posted:
Aug 2, 2003 @ 3:57am
by fzammetti

Posted:
Aug 2, 2003 @ 4:42am
by Datalore
Ah, your suggestion worked. 1 error down, the rest to go. Unfortunately, your suggestion only helped that one example. I'm mainly getting crap like "cannot convert from char[19] to unsigned short". Thanks so much for helping with this.

Posted:
Aug 2, 2003 @ 4:54am
by fzammetti
That error generally points to the same kind of problem... Your passing in an array of char's, but it's looking for a pointer (I believe an LPCSTR is the same thing as an unsigned short in this case).

Posted:
Aug 2, 2003 @ 11:36am
by simonjacobs

Posted:
Aug 2, 2003 @ 2:22pm
by fzammetti

Posted:
Aug 2, 2003 @ 2:51pm
by simonjacobs

Posted:
Aug 2, 2003 @ 3:07pm
by fzammetti

Posted:
Aug 2, 2003 @ 8:51pm
by ChezDoodles
To convert from char[] to wchar[], use MultiByteToWideChar, and to go from wchar[] to char[] use WideCharToMultiByte.
Don't worry that the funtion is called "MultiByte" - it refers to MBCS (MultiByteCharacterString) which is also a char[] deep down. MBCS is normally one 1 byte chars - but some characters inbetween can be 2 byte to support special characters sets. MBCS was a step along the way from ANSI to UNICODE on the Win9x platform back in the '90s.
MBCS

Posted:
Aug 3, 2003 @ 4:26am
by mlepage
I believe MBCS is variable-byte-length characters. That is, physically, the string is single byte characters, but logically, a character can be 2 (or more?) bytes. It makes algorithms (e.g. go forward 4 characters) hell. Stick with single-byte characters or UNICODE (wide characters).

Posted:
Aug 3, 2003 @ 8:18am
by ChezDoodles
Check the documentation to the two functions - you can specify ANSI codepages - meaning there is no risk ending up with characters that actually takes up more space than one byte if you don't want to.