I'm writing a GIF file parser and it works on small images but I can't read files bigger than 1000 bytes using
toBinaryData(readfile 'xxxx.gif')
I know some file primitives have been added to GP but I've been unable to work out how to use them
Help! :)
[EDIT]
There's not a 1000 byte limt - it was pure coincidence that it worked on a file < 1000 but failed on a file that was 1003 long
The bug seems to be not reading until the end of the file - I can get it to fail on files < 1000
my test code is
Here are some gif files that show issue
is OK
is not
is not
is not
1000byte limit on fileread
Moderator: MSandro
Re: 1000byte limit on fileread
This problem is that the "read file" block in the palette is not revealing the optional second parameter, a boolean that indicates that the file is binary. So you're files are getting truncated at the first EOF character encountered. Binary data typically has many EOF bytes (1 in 256 bytes, if the byte distribution were uniform).
I will fix that. Meanwhile, you can use the trusty "blockify" menu command in a Workspace to get a block with that parameter. Type:
readFile 'foo.gif' true
in a Workspace window, select it, then select "blockify it..." from the right-click menu.
Hope that helps!
I will fix that. Meanwhile, you can use the trusty "blockify" menu command in a Workspace to get a block with that parameter. Type:
readFile 'foo.gif' true
in a Workspace window, select it, then select "blockify it..." from the right-click menu.
Hope that helps!
Re: 1000byte limit on fileread
:)
readfile 'filename.txt' true
has fixed the issue :)
readfile 'filename.txt' true
has fixed the issue :)