That's fine for users, but
life gets weird if you want do something repeatable. (Yes, some people are still stuck maintaining
Win16 code; I average about a day a month on that).
NT does not require that the
OS be installed in a directory named
winnt; that's the
default, but
you can't count on it. I'm told that it need not even be on the
c: drive.
GetWindowsDirectory() is
Win32-only, so you can't do that either.
getenv() is
ANSI C, according to the
Borland docs (it's in
K&R, too), so you should be able to get
%WINDIR% that way. Then, of course, you've got problems with "
long file name" bullshit . . .
tftv256 has a point. The only safe way is to dig into the registry. I don't know how much you can do with the registry in Win16; I seem to recall that there is at least a minimal API . . . If you've got enough time on your hands to do it all by hand with read(), God bless you :) In Win32 there's SHGetSpecialFolderLocation(), which hides the labyrinthine registry crapola. Thank God it's unlikely anybody will have to do this in Win16.