FB II Compiler

PG PRO

Debugging

Memory

System

Mathematics

Resources

Disk I/O

Windows

Controls

Menus

Mouse

Keyboard

Text

Fonts

Drawing

Sound

Clipboard

Printing

Communication

ASM

Made with FB

DISK I/O

Retrieve a file name with SFPGETFILE


Considering that the SFPGETFILE is the same as the SFGETFILE (except for dlogID and digEvtFilter), try this:

'Because some of Standard File Package Procedures and Funtions are not
'implemented in FB, I define and alloc SFReply Record to use SFGetFile
'procedure.
'See Think Ref 2.0 > Standard File Package > SFGetFile
'
DIM RECORD SFReply
  DIM mgood% 'good & copy bytes
  DIM mType&
  DIM mvNum%
  DIM mvers%
  DIM 63 mName$
DIM END RECORD.SFReply
DIM reply.SFReply

LOCAL FN getFileName 'BOOL GetFilename(BYTE *name,WORD *vRefNum)
  DIM where&
  DIM typeList&
  where.v=50
  where.h=70
  typeList&=_"INIT"
  CALL SFGETFILE(where&,"",_nil,1,typeList&,_nil,reply)
  vRefNum% = reply.mvNum%
  fName$ = reply.mName$
END FN = reply.mgood%

Tedd


Note

Just a caveat: According to Think Reference, the first two bytes are set up like this (as the comment above indicates):

boolean good
boolean copy

TR says that the copy field is not used though, so that's why people are getting away with defining the good field as an integer. However, if you were to write:

long if SFReply.mgood%=1
...do stuff
end if

then you might be in for a nasty surprise to find that the mgood% value was 2^8 instead of 1.

Wave