Futurebasic/Language/Reference/filesstr fopen



✔ Appearance ✔ Standard ✔ Console


fileName$ = FILES$(_fOpen,[typeListString$],¬
  [promptString$], refNumVar%)
fileName$ = FILES$(_fOpenPreview,[typeListString$],¬
  [promptString$], refNumVar%)
fileName$ = FILES$(_FSSpecOpen,[typeListString$],¬
  [promptString$], fileSpecRecord)
fileName$ = FILES$(_FSSpecOpenPreview,[typeListString$],¬
  [promptString$], fileSpecRecord)

gFBUseNavServices = _zTrue|_false


February, 2002 (Release 6)


This function prompts the user to select an existing file. It does this by displaying the standard "Get File" dialog shown below (its appearance may be different on some systems). If the user selects a file, then the file's name is returned in fileName$, and a reference number for the file's directory is returned in refNumVar% (which must be a short integer variable). If the selected file is in a volume's root directory, the 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.

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.

You can limit the types of files that appear in the dialog by specifying up to four file types in typeListString$. For example, is you pass the string "TEXTPICT" in typeListString$, then only files of type "TEXT" and type "PICT" will be available for selection. If typeListString$ is an empty string, or the parameter is omitted, then all file types will be available for selection.

Image was here

If you use the optional _fOpenPreview (or _FSSpecOpenPreview ) parameter, the standard files dialog may display a preview of the file currently selected.

Image was here.

The FILES$(_fOpen...) function does not actually open the selected file. Use the OPEN statement if you need to open the file.

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 AlsoEdit

FILES$; FILES$(_fSave...); FOLDER; OPEN; Appendix H: file Spec Records