[fpc-pascal] Resources or alike

Michał Woźniak mikiwoz at yahoo.co.uk
Sun Mar 20 13:19:44 CET 2005


> > Dnia sobota, 19 marca 2005 23:31, Nico Arag?n napisa?:
> > > IIRC, you don't even need resources:
> > >
> > >   copy /b program.exe + file.dat combined.exe
> > >
> > > Then you can open combined.exe from itself, seek to (filelength -
> > > sizeofdatafile -1) and use blockread.
> >
> > Uhmm... I get a Runtime error 026 everytime I try to open the executable
> > for reading from within itself. Here's the code:
>
> Known windows problem. Windows lock all .exe's.

Nope - it's under Linux. :)

> Keep in mind that reset is actually read/write.
>
> Try :
>
> - Before the reset, add filemode:=0;
> - change the reset to reset(exefile,1); since I doubt you want to access
> 	it in 128 bytes units.

ExeFile is defined as File of byte, therefore the file is already accessed in 
1-byte units.

FileMode solved the problem. Thanks.

Cheers
Mike





More information about the fpc-pascal mailing list