Qbasicnews.com

Full Version: File input bug
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Code:
buffer = space$(8192)
open "Any file.what" for binary as #1
print lof(1)
get #1, 1, buffer
print len(buffer)
close #1

If the file is less then buffersize, buffer$ will still be 8192 bytes.

In qb buffer$ would change to the actuall number of bytes read from the file.
Not true, try it on QB..

BC 4.5:
Code:
C:\prg\code\bas\FREEBA~1>test test.bas
141
8192

FB:
Code:
C:\prg\code\bas\FREEBA~1>fbc test.bas

C:\prg\code\bas\FREEBA~1>test test.bas
141
8192
The better way to do that, Z!re, is to get the LOF and then resize the string to it. Neither in VB nor QB will the string resize itself the way you have it.
Hmm, I could have sworn it didnt work that way in QB.. ohh well..

And ya Ado, i just found it when trying to compile some old source that didnt do that, fixed it though, like you said.


Ohh well, sorry about tat then Big Grin