On Mon, May 21, 2012 at 03:23:39PM -0700, James Paige wrote:
> I was messing around with trying to make a simplified test case for the 
> LOF bug. I never did figure out exactly what to type to compile a simple 
> .bas file, but I discovered it was easy to just add another compile 
> target to SConscript using relump and unlump as my model.
> 
> I couldn't reproduce any oddness with LOF, but I did discover some 
> peculiar behavior when a file is opened BINARY ACCESS READ
> 
> The following code works perfectly on Linux, but on Mac, it fails to 
> read anything at all from the first two files. The third and fourth file 
> work fine.
> 
> If you change
> - OPEN filename FOR BINARY ACCESS READ AS #fh
> + OPEN filename FOR BINARY AS #fh
> Then the code works perfectly on Mac.
> 
> ------------------------------------------------------
> 
> SUB test(filename as string)
>  DIM size as integer
>  DIM chunk as string = STRING(10, 0)
> 
>  DIM fh as integer = FREEFILE
> 
>  OPEN filename FOR BINARY ACCESS READ AS #fh
> 
>   PRINT filename
> 
>   '--Read and print the first 10 bytes
>   GET #fh, , chunk
>   PRINT "10bytes=""" & chunk & """"
> 
>  CLOSE #fh
> END SUB
> 
> 
> DIM testfiles(3) as string = {"README-game.txt", "README-custom.txt", 
> "whatsnew.txt", "IMPORTANT-nightly.txt"}
> 
> DIM size as integer
> FOR i as integer = 0 TO UBOUND(testfiles)
>  test testfiles(i)
> NEXT i

I was messing around some more with this same test case, and I realized 
I was wrong. it isn't that OPEN FILENAME FOR BINARY ACCESS READ fails 
for the first two opens, because I can rearrange the filenames, and the 
same filenames fail.

Why would the filename make a difference for whether or not data can be 
read from the file?

---
James
_______________________________________________
Ohrrpgce mailing list
[email protected]
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org

Reply via email to