You may need to increase the size of fixed-length buffers for filenames and environment strings. Windows 95 and Windows NT support filenames of up to 256 characters, rather than the 8.3 format supported by MS-DOS. You can make code more portable by allocating longer buffers or by using dynamic memory allocation. If you want to conserve memory under Windows 3.x, you can use #ifdef statements to allocate buffers of the proper length for the environment. You can also use macros such as _MAX_PATH and _MAX_FNAME, defined in STDLIB.H.
Windows 95 and Windows NT require stricter use of file open and close operations than Windows 3.x. There are some combinations of open and close functions (for example, mixing _open with _lclose) that may work in code for Windows 3.x, but require revision to work correctly with Windows 95 and Windows NT.
You may also need to make changes in low-level file I/O. In porting Windows 3.x code, some developers change from using the Windows API file I/O functions (such as _lopen and _lread) to using the C run-time low-level I/O functions (such as _open and _read). All versions of the Windows API support only binary mode, not text mode, but the C run-time calls use text mode by default. Therefore, when changing from the Windows file I/O to the C run-time versions, open files in binary mode by doing one of the following:
Link with BINMODE.OBJ, which changes the default mode for all file-open operations.
Open the individual files with _O_BINARY flag set.
- Use setmode to change an open file to _O_BINARY.