Incbin not working?
Archives Forums/BlitzMax Bug Reports/Incbin not working?
| ||
I have used this code snippet in my programs for a long time but only just noticed its stopped working. Any ideas?Strict Incbin "version.txt" DebugLog "version = " + String.FromBytes(IncbinPtr("incbin::version.txt"),IncbinLen("incbin::version.txt")) |
| ||
It seems to me that IncbinLen is failing -- it always returns zero. I've just tried your example with a small text file, and tried it on a version of RockOut, where IncbinLen still returns zero despite the Incbin'd player image working. Looks like a bug to me! |
| ||
Incbin "version.txt" DebugLog IncbinLen("incbin::version.txt") DebugLog Int (IncbinPtr("incbin::version.txt")) DebugLog "version = " + String.FromBytes(IncbinPtr("incbin::version.txt"),IncbinLen("incbin::version.txt")) ' *** This shows it was loaded OK... DebugLog LoadText ("incbin::version.txt") IncbinPtr returns zero too. Both appear to depend on a call to the find function in blitz_incbin.c, so perhaps something's wrong there? (I still don't get how the loading functions that depend on this stuff can be working though!) |
| ||
Remove incbin:: from the stringIncbin "version.txt" DebugLog IncbinLen("version.txt") DebugLog Int (IncbinPtr("version.txt")) DebugLog "version = " + String.FromBytes(IncbinPtr("version.txt"),IncbinLen("version.txt")) ' *** This shows it was loaded OK... DebugLog LoadText ("incbin::version.txt") Spent 1/2 hour putting printf statements in the source before tracking this down. Could've solved it with 5 seconds from looking at the sample in the docs :D Last edited 2011 |
| ||
Ah, right enough... I always think of Incbin'd filename access as being preceded by "incbin::"... I guess we can close this one then. |