Discussion Locked

from normal byte to double byte programm

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

We are changing existing source code from single byte to double byte. What are the booby traps? Platform HP-UX 11 and Windows NT 4.0 SP 5. Programming language C, VB6.0
Database Oracle 8 or 8i

3 replies

by denis

There are many.
- don't use type 'char' anywhere, use a custom-defined type like TCHAR in the windows codebase that you redefine to 16-bit.
- find all custom functions that deal with the 'char' and change them to this type
- make sure there areno assumptions anywhere about a character being one byte. For example, some places you may need to change a '1' to a 'sizeof(TCHAR)'
- make sure the correct system library string functions are being called (in windows if you define UNICODE it will use all the *W functions instead of the *A functions). You may not have this support onyour unix platform and may need to implement your own string functions or get a library

- be careful with strings passed to system library calls. For example, if your filenames are now stored as double byte, then you either need to call a double byte version of that system call, or you need to explicitly write a conversion function (double byte->single byte) to prepare filenames for each system librarycall (such as "rename" or "unlink"). If you were using C++ you could make this conversion implicit

This discussion is closed to new replies.