Navigation: ABC Library Reference > ASCIIFileClass > AsciiFileClass Methods >====== GetDOSFilename (let end user select file) ====== | |
GetDOSFilename( filename ), VIRTUAL
GetDOSFilename | Prompts the end user to select the file to process. |
filename | The label of the ASCIIFile property's NAME attribute variable which receives the selected filename. |
The GetDOSFilename method prompts the end user to select the file to process and returns a value indicating whether the end user selected a file or did not select a file. A return value of one (1) indicates a file was selected and filename contains its pathname; a retun value of zero (0) indicates no file was selected and filename is empty.
Implementation:
The GetDOSFileName method uses a SelectFileClass object to get the filename from the end user.
Return Data Type: BYTE
Example:
MyAsciiFileClass.Reset FUNCTION(*STRING FName)
RVal BYTE(True)
SavePath CSTRING(FILE:MaxFilePath+1),AUTO
CODE
CLOSE(SELF.AsciiFile)
SavePath=PATH()
LOOP
IF ~FName AND ~SELF.GetDOSFilename(FName)
RVal=False
BREAK
END
OPEN(SELF.AsciiFile,ReadOnly+DenyNone)
IF ERRORCODE()
MESSAGE('Can't open ' & FName)
RVal=False
ELSE
BREAK
END
END
IF RVal
SELF.FileSize=BYTES(SELF.AsciiFile)
END
SETPATH(SavePath)
RETURN RVal
See Also: