- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have an older program that open a file without specifying a path name. I know I can use the "DEFAULTFILE" specifier to indicate where to create-it. But, is there a function available to get the Windows Temp folder I can use with this?
Also, when I open a file of type 'SCRATCH', I know the program opens a file of a random name but for some reasons, the file is open in the root of the C drive. This drive is typically set as read only for regular user Windows account (especially with Windows Vista / 7). Why isn't the scratch file created in the Windows temp by default and is there a way to force the scracth file to be created in a specific folder? Can I use the same trick as above (DEFAULTFILE=)?
Thank You
Philippe Bernier
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can use the GET_ENVIRONMENT_VARIABLE intrinsic to retrieve the value of "TEMP", which points to your temp folder. An undocumented feature is that you can use environment variables in the FILE= specificer of OPEN, like this:
OPEN (1,FILE="%TEMP%\somefile.dat")
I don't think this works in DEFAULTFILE.
Scratch files are opened in the temp directory, so perhaps TEMP (or TMP - I don't remember which it uses first) points to C:\?
OPEN (1,FILE="%TEMP%\somefile.dat")
I don't think this works in DEFAULTFILE.
Scratch files are opened in the temp directory, so perhaps TEMP (or TMP - I don't remember which it uses first) points to C:\?

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page