including text files in built apps

BlitzMax Forums/BlitzMax Beginners Area/including text files in built apps

jkrankie(Posted 2005) [#1]
is there anyway of doing this? i tried incbin, but i couldn't access the file.

cheers
charlie


Kev(Posted 2005) [#2]
this works, from the help


Rem
IncBinPtr returns a byte pointer to the specified embedded binary file.
End Rem

Incbin "incbinptr.bmx"

Local p:Byte Ptr=IncbinPtr("incbinptr.bmx")
Local bytes=IncbinLen("incbinptr.bmx")

Local s$=String.FromBytes(p,bytes)

Print "StringFromBytes(p,bytes)="+s$




jkrankie(Posted 2005) [#3]
move along, nothing to see in this post...


jkrankie(Posted 2005) [#4]
ok, this works for reading the file, but how would i make changes to it once its embedded?


xlsior(Posted 2005) [#5]
ok, this works for reading the file, but how would i make changes to it once its embedded?


You can't, the executable is locked while its running, so you can't make any changes to itself... And even if you could, that would probably not be a good idea since many virus scanners have a dim view of running executables modifying themselves on the fly, looks a bit suspicious.

If you need to save info, you're going to have to deal with an external file.


jkrankie(Posted 2005) [#6]
Ok, thanks very much.

cheers
Charlie