Restored from previous forum. Originally posted by Gwen.
Hi
Is there a way to get the name/path of the running purebasic exe ?
And is there then a way for a PB exe to load it's own exe file from disk??
I would like to be able to append data to the end of the running exe and then save it to a new filename i.e MyNew.exe this would be the beginnings of a simple program generator...
I do this easily in Delphi... I stumbled upon the Purebasic web site and liked the idea of being able to make such tiny executables! But I need to be able to do some basic stuff like this and can't find any info about such things in the Purebasic help...
Restored from previous forum. Originally posted by Gwen.
Hello PB
Thanks! That works perfectly
Now I just have to figure out how to load the running exe into something I can work with... a string maybe .... and then append some data to it, and then write the modified data to disk as 'MyNew.exe'
..Gwen..
p.s. PureBasic could really use a complete users guide with lots of examples!
just a simple guide with demo code for each routine,function,keyword..etc would be a great help
If OpenFile(0, "myapp.exe")
FileSize = FileSize("myapp.exe")
ReadData(AllocateMemory(0, Filesize, 0), FileSize)
; now the app binary data is located at MemoryID()
CloseFile(0)
EndIf
; modify whatever
If OpenFile(0, "mynewapp.exe")
WriteData(MemoryID(), NewFileSize)
; change NewFileSize to siut the new file size :wink:
CloseFile(0)
EndIf
Hope this was what you were looking for. Otherwise, insist