On Thu, May 31, 2012 at 09:46:46AM -0700, James Paige wrote:
> On Thu, May 31, 2012 at 09:34:19AM -0700, James Paige wrote:
> > 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?
>
> On further examination, it seems to be the contents of the file that
> make a difference, not the filename.
>
> Some files are read as all zeroes... some files are read normally.
>
Another observation:
This bug apparently NEVER happens to any file >= 4096 bytes.
I still haven't figured out the rhyme or reason to which files < 4096
bytes are affected.
---
James
_______________________________________________
Ohrrpgce mailing list
[email protected]
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org