GLBasic forum

Main forum => Bug Reports => Topic started by: FutureCow on 2009-Nov-05

Title: GETFILESIZE fails if file is open for reading
Post by: FutureCow on 2009-Nov-05
I have a file open for reading, running GETFILESIZE against that filename (not the file's handle) returns 0.
Title: Re: GETFILESIZE fails if file is open for reading
Post by: Moru on 2009-Nov-05
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
Title: Re: GETFILESIZE fails if file is open for reading
Post by: FutureCow on 2009-Nov-05
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?
Title: Re: GETFILESIZE fails if file is open for reading
Post by: Moru on 2009-Nov-05
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?
Title: Re: GETFILESIZE fails if file is open for reading
Post by: MrTAToad on 2009-Nov-05
QuoteOr perhaps just say in the manual that you can't use GETFILESIZE if the file is already open?
Mine does :)