You might need to do this, not because you're planning on creating a Mandarin version of your code, but simply because you want to compile your legacy code under .NET.
The Find and Replace function from VS2005 comes handy.
- Replace hard-coded string "blah" with _T("blah"). Use regular expressions: The best regular expression I found so far is the following:
~((_T.)(\#include ))("[^"\)]*")('[^']*')
although it's still not perfect.
- Replace LPCSTR with LPCTSTR.
- Replace SQLCHAR with SQLTCHAR .
- Replace char with TCHAR (rather than wchar_t which would work only in UNICODE).
- Replace strcpy with _tcscpy.
- Replace strncpy with _tcsncpy.
- Replace atoi with _tstoi.
- Replace strlen with _tcslen.
- Replace sprintf with _stprintf.
- Replace atof with _tstof.
- Replace itoa with _itot.
- Replace strcmp with _tcscmp.
Resources:
- MSDN:Generic Text Mappings
- Code Project: CString Management.
2 comments:
thc much
I would like to exchange links with your site www.codinginlondon.com
Is this possible?
Post a Comment