Writing user code for unicode
The Scheduler uses Unicode to support international string issues. To write code that can be conditionally compiled for Unicode, MBCS, or neither, follow these programming guidelines:
- Use the _T macro to code literal strings conditionally to be portable to Unicode. For example:
- psqlda = dboptab (_T(“MYBOM”), p_ssgvar->sgctrl.scprtds, DB_FETCH)
- When you pass strings, pay attention to whether function arguments require a length in characters or a length in bytes. The difference is important if you’re using Unicode strings.
- Use portable versions of the C run-time string-handling functions. See the section on String Manipulation in the Microsoft Visual C/C++ documentation for a complete list and for further information.
See the table below for examples.
Use This | Instead of |
---|---|
_tcscpy | strcpy |
_tcsncpy | strncpy |
_tcscmp | strcmp |
_tcsncmp | strncmp |
_tcscat | strcat |
_tcsncat | strncat |
_tcschr | strchr |
_stprintf | sprintf |
Use the following data types for characters and character pointers:
- TCHAR where you would use char.
- LPTSTR or TCHAR * where you would use char*.
- LPCTSTR where you would use const char*.