How to copy an included file ? need help

Just starting out? Need help? Post your questions and find answers here.
TeddyLM
Enthusiast
Enthusiast
Posts: 133
Joined: Wed Apr 30, 2003 2:04 pm
Location: Germany (French expat)

How to copy an included file ? need help

Post by TeddyLM »

I want to write a small Installer.

I used Includebinary to have one big file (included an executable and a few datafiles) but i don't know how to copy them back on my Harddrive.
The CopyFile-command only work with extern Files.

Does somebody have an idea ?
plouf
Enthusiast
Enthusiast
Posts: 282
Joined: Fri Apr 25, 2003 6:35 pm
Location: Athens,Greece

Post by plouf »

create an empty file and use CopyMemory()
add a label before includebinary command
and ?label will give the pointer to this address :)
Christos
freak
PureBasic Team
PureBasic Team
Posts: 5948
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

Simple old snippet...

Code: Select all


If CreateFile(0, "SomeNewFile.file")
  WriteData(?File_Start, ?File_End - ?File_Start)  ; ?File_End - ?File_Start = FileSize
  CloseFile(0)
Endif


; ---------------------------------------

DataSection
File_Start:
  IncludeBinary "Whatever.file"
File_End:
EndDataSection

Timo
Last edited by freak on Thu Aug 28, 2003 12:09 pm, edited 1 time in total.
quidquid Latine dictum sit altum videtur
TronDoc
Enthusiast
Enthusiast
Posts: 310
Joined: Wed Apr 30, 2003 3:50 am
Location: 3DoorsDown

Post by TronDoc »

freak wrote:Simple old snippet...

Code: Select all

  WriteData(?FileStart, ?File_End - ?File_Start)  ; ?File_End - ?File_Start = FileSize
Timo
typo in that line ?FileStart, should be ?File_Start,
then it works great! Joe
peace
[pI 166Mhz 32Mb w95]
[pII 350Mhz 256Mb atir3RagePro WinDoze '98 FE & 2k]
[Athlon 1.3Ghz 160Mb XPHome & RedHat9]
TeddyLM
Enthusiast
Enthusiast
Posts: 133
Joined: Wed Apr 30, 2003 2:04 pm
Location: Germany (French expat)

Post by TeddyLM »

Thanx a lot

works fine
Post Reply