Wide strings are UNICODE and often have embedded zeroes in them, since it's 2 bytes per character.
sprintf stops reading bytes as soon as it hits a zero terminator and adds a single zero terminator at the end.
Wide strings are terminated with 2 zero chars.
If a function is asking for a LPCWSTR, then a char* LPSTR or const char* LPCSTR won't do; there's no implicit conversion from char* to WCHAR* (WCHAR == wchar_t typedef) in C. If you want portable code that will work whether or not UNICODE is #define'd, look up TCHAR, _T and _stprintf and related.
Another alternative is to use a C++ class string type which has a conversion operator defined from char* to WCHAR*. That will allocate a buffer and copy the ANSI string into a UNICODE one which will be twice as long in memory.
[edited by - Paradigm Shifter on January 28, 2003 8:16:55 AM]