Problem with exec();

Posted By: HoopyDerFrood

Problem with exec(); - 03/05/08 13:23

Hello,

I try to execute a Program with the A7 using the exec(); command.

Code:

function exectest()
{
exec("KleinesEinmaleins.exe", ""); //a simple C console application
beep(); // to let me hear the function was started
}

function DebugKeyBinds_startup()
{
on_m = exectest;
}



And nothing happend. I hear the beep, so the function is executed but this is everything. Absolut no reaction. The Programm "KleinesEinmaleins.exe" is located in the main Folder so the engine should find it. I tryed to place it in an Folder I included with PATH "" but there was no difference.

Could anyone help me with this Problem?

Thank you in advance.
Posted By: Serex

Re: Problem with exec(); - 03/05/08 14:13

I cannot see any problems with your code. I however would like to see you check to see if the file exists before trying to execute it. So something like...

Code:
  
function exectest()
{
var file_handle = file_open_read("KleinesEinmaleins.exe");

if (file_handle != 0) // if the file exists
{
exec("KleinesEinmaleins.exe", ""); // A simple C console application
}
else
{
beep();
}
}



The application will beep if the file isn't found.
© 2024 lite-C Forums