The usual way to determine the Windows' main directory is based on the GetTempPath API function, which requires that you set up a buffer for the result, and then extract the null-terminated result. However, there is a much simpler approach, that works equally well under Windows 95, 98 and NT. It is based on the fact that either the TMP or TEMP environment variables (or both of them) already holds the path to that directory, so you just need a single line of code: |
|