exec()

[b][red]This message was edited by bpajk at 2003-10-21 12:12:5[/red][/b][hr]
My program doesn't go pass the exec() statement! How do I tell him to execute and go foward? When I used Dev-Pascal for a compiler it went passed but in Free-pascal it stops at exec().
[CODE]
program test;
uses dos;
begin
swapvectors;
exec('c:windows
otepad.exe','');
swapvectors;
readln
end.
[/CODE]


Comments

  • : [b][red]This message was edited by bpajk at 2003-10-21 12:12:5[/red][/b][hr]
    : My program doesn't go pass the exec() statement! How do I tell him to execute and go foward? When I used Dev-Pascal for a compiler it went passed but in Free-pascal it stops at exec().
    : [CODE]
    : program test;
    : uses dos;
    : begin
    : swapvectors;
    : exec('c:windows
    otepad.exe','');
    : swapvectors;
    : readln
    : end.
    : [/CODE]

    What flavour of FPC? If it's the GO32V2 one, you may need to use:

    [code]
    exec(GetEnv('COMSPEC'), '/C c:windows
    otepad.exe');
    [/code]
  • : : [b][red]This message was edited by bpajk at 2003-10-21 12:12:5[/red][/b][hr]
    : : My program doesn't go pass the exec() statement! How do I tell him to execute and go foward? When I used Dev-Pascal for a compiler it went passed but in Free-pascal it stops at exec().
    : : [CODE]
    : : program test;
    : : uses dos;
    : : begin
    : : swapvectors;
    : : exec('c:windows
    otepad.exe','');
    : : swapvectors;
    : : readln
    : : end.
    : : [/CODE]

    :
    : What flavour of FPC? If it's the GO32V2 one, you may need to use:
    :
    : [code]
    : exec(GetEnv('COMSPEC'), '/C c:windows
    otepad.exe');
    : [/code]
    :
    :///////////////////////////////////////////////////////////////////
    Try is one:
    : program test;
    : uses dos;
    : begin

    : command := '/c' + 'windows
    otepad.exe' ;
    : swapvectors;
    : exec(getenv('COMSPEC'), command);
    : swapvectors;
    :////////////////////////////////////////////////////////////////////

    May you can help me in closing that program (written in perl)
    Best Regards
    Werner


  • : : : [b][red]This message was edited by bpajk at 2003-10-21 12:12:5[/red][/b][hr]
    : : : My program doesn't go pass the exec() statement! How do I tell him to execute and go foward? When I used Dev-Pascal for a compiler it went passed but in Free-pascal it stops at exec().
    : : : [CODE]
    : : : program test;
    : : : uses dos;
    : : : begin
    : : : swapvectors;
    : : : exec('c:windows
    otepad.exe','');
    : : : swapvectors;
    : : : readln
    : : : end.
    : : : [/CODE]
    :
    : :
    : : What flavour of FPC? If it's the GO32V2 one, you may need to use:
    : :
    : : [code]
    : : exec(GetEnv('COMSPEC'), '/C c:windows
    otepad.exe');
    : : [/code]
    : :
    : :///////////////////////////////////////////////////////////////////
    : Try is one:
    : : program test;
    : : uses dos;
    : : begin
    :
    : : command := '/c' + 'windows
    otepad.exe' ;
    : : swapvectors;
    : : exec(getenv('COMSPEC'), command);
    : : swapvectors;
    : :////////////////////////////////////////////////////////////////////
    :
    : May you can help me in closing that program (written in perl)
    : Best Regards
    : Werner


    Was that a suggestion for bpajk to try, or are you asking for help with that code?
  • : : : : [b][red]This message was edited by bpajk at 2003-10-21 12:12:5[/red][/b][hr]
    : : : : My program doesn't go pass the exec() statement! How do I tell him to execute and go foward? When I used Dev-Pascal for a compiler it went passed but in Free-pascal it stops at exec().
    : : : : [CODE]
    : : : : program test;
    : : : : uses dos;
    : : : : begin
    : : : : swapvectors;
    : : : : exec('c:windows
    otepad.exe','');
    : : : : swapvectors;
    : : : : readln
    : : : : end.
    : : : : [/CODE]
    : :
    : : :
    : : : What flavour of FPC? If it's the GO32V2 one, you may need to use:
    : : :
    : : : [code]
    : : : exec(GetEnv('COMSPEC'), '/C c:windows
    otepad.exe');
    : : : [/code]
    : : :
    : : :///////////////////////////////////////////////////////////////////
    : : Try is one:
    : : : program test;
    : : : uses dos;
    : : : begin
    : :
    : : : command := '/c' + 'windows
    otepad.exe' ;
    : : : swapvectors;
    : : : exec(getenv('COMSPEC'), command);
    : : : swapvectors;
    : : :////////////////////////////////////////////////////////////////////
    : :
    : : May you can help me in closing that program (written in perl)
    : : Best Regards
    : : Werner
    :
    :
    : Was that a suggestion for bpajk to try, or are you asking for help with that code?
    :
    It worked! But There is a trick to this:
    If you use: exec('c:windows
    otepad.exe',''); It will not pass the exec() statement until the program is finished, but if you use: exec(GetEnv('COMSPEC'), '/Cc:windows
    otepad.exe'); it will execute the program and go pass. Thanx!


  • Hi Bpajk,

    I have the same problem in FPC, when opening the notepad.
    SwapVectors;
    Exec(GetEnv('COMSPEC'),'/C '+ '>notepad.exe c:active.txt');
    SwapVectors;


    Exec() opens the notepad but the program doesn't go forward until notepad is closed.

    I tried your code:
    exec(GetEnv('COMSPEC'), '/Cc:windows
    otepad.exe');

    but the effect is just the same.
    The programs opens notepad and stops.

    Can you help and tell how you solved the problem?
  • [code][color=Blue]// Compiler: FPC

    uses windows;

    begin
    [b]winexec('notepad.exe',1);[/b]
    writeln('Test');
    readln;
    end.[/color][/code]
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories