GETFILESIZE fails if file is open for reading

Previous topic - Next topic

FutureCow

I have a file open for reading, running GETFILESIZE against that filename (not the file's handle) returns 0.

Moru

If you lock the file, don't expect others to access it :-) To find the size of an open file you need to go to the end of it and ask the system what position you are on. See FILESEEK and FILEPOSITION

FutureCow

Why can't the command record the current position, move to the end of the file, find the file size, then move back to the stored current position?
Or error if the file has already been opened?
Or perhaps just say in the manual that you can't use GETFILESIZE if the file is already open?

Moru

I can't remember ever seeing a basic dialect that can check the filesize (reliably) on an open file. It doesn't have to be your program that has locked the file, how would GLBasic know this?

MrTAToad

QuoteOr perhaps just say in the manual that you can't use GETFILESIZE if the file is already open?
Mine does :)