[fpc-pascal] Resources or alike

Michał Woźniak mikiwoz at yahoo.co.uk
Sun Mar 20 12:37:32 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:

try

    writeln('Assigning file "' + ParamStr(0) + '".');
    Assign(ExeFile, ParamStr(0));

    writeln('Reseting...');
    Reset(ExeFile); // <- ERROR HERE

    writeln('Seeking...');
    Seek(ExeFile,FileSize(ExeFile)-14);

  except

    on E:Exception do
    begin
      writeln('Exception: ' + E.Message);
      halt;
    end;

  end;

Am I missing something?

TIA
Mike





More information about the fpc-pascal mailing list