Futurebasic/Language/Reference/filesstr fsave

FILES$(_fSave...) edit

Function edit

✔ Appearance ✔ Standard ✔ Console

Syntax edit

fileName$ = FILES$(_fSave,[prompt$],[defaultName$],refNumVar%)
fileName$ = FILES$(_FSSpecSave,[prompt$],[defaultName$],fileSpecRecord)

gFBUseNavServices = _zTrue|_false

Revised edit

February, 2002 (Release 6)

Description edit

This function prompts the user to provide a file name, and to select a folder where the file may be saved. It does this by displaying the standard "Put File" dialog shown below (its appearance may be different on some systems). If the user selects a name, then the name is returned in fileName$, and a reference number for the selected directory is returned in refNumVar% (which must be a short integer variable). If the selected directory is a volume's root directory, then refNumVar% will return a volume reference number; otherwise, it will return a working directory reference number. If the user cancels the dialog, then the function returns an empty (zero-length) string, and it sets refNumVar% to zero.

The string (if any) that you provide in prompt$ will appear as a one-line prompt in the dialog. The string (if any) that you provide in defaultName$ will appear initially in the file name edit field in the dialog.

If the global variable gFBUseNavServices is non-zero, FB switches to the more modern Navigation Services dialog.. If the one of the FSSpec version of the call is used, gFBUseNavServices is assumed to be _zTrue.

Example:
The statement:

fileName$ = FILES$(_fSave,"Save game as:", "Game 1",refNum%)

will produce a dialog that looks something like this:

Image was here.

Note:
The FILES$(_fSave...) function does not actually open or save a file. Use the OPEN statement if you need to open a file, and use output statements like PRINT# or WRITE# to save information into it.

The reference number returned in refNumVar% is a temporary number, which is only valid until your program quits. You cannot use this same number to refer to this folder at a later date. If you need to keep track of a file's location over time, create and save an alias record for the file.

See Also edit