我开始知道在QBASIC中可以使用BOF功能。它被称为文件的开头。但是,我没有找到任何关于其使用的例子。请帮忙。
答案 0 :(得分:-1)
以下是可能的BOF功能的示例:
' example BOF function in QB
' returns beginning of file
PRINT "Enter filename";: INPUT F$
Handle = FREEFILE
OPEN F$ FOR BINARY AS #Handle
PRINT "BOF="; BOF(Handle)
END
' function to get BOF
FUNCTION BOF (H)
IF LOF(H) > 0 THEN
BOF = 1
ELSE
BOF = 0
END IF
END FUNCTION
用于确定文件是否处于BOF的示例:
' example BOF function in QB
' returns true if at beginning of file.
PRINT "Enter filename";: INPUT F$
Handle = FREEFILE
OPEN F$ FOR BINARY AS #Handle
IF BOF(Handle) THEN
PRINT "File is at BOF"
END IF
END
' function to get BOF
FUNCTION BOF (H)
IF LOC(H) <= 1 THEN
BOF = -1
ELSE
BOF = 0
END IF
END FUNCTION