Error when running C++ application with 'exec'
Posted by Dimon (Dimon), 23 September 2005Hi all.
My Tcl/Tk application is a GUI for C++ program, it calls C++ program with different command line parameters. All still worked correctly but at the end of developing I found a unanderstandable error. When I customary call C++ program with 'exec' command, I recieve an error:
TestRider.exe - my C++ program
-BuildTable, -NewDevicename, -TesterTable are the keys
Paths are a values for corresponding keys.
Double slashes need for correct parsing inside c++ program.
The calling string is:
Where value of 'directive' variable shown up.
If I run that command like standalone tcl script with tclsh84 or wish84, C++ program called and work correctly. But when I call it from my own Tk-shell, it return the error showed up.
I don't know what to do 'cause I call this C++ program many times in my Tcl/Tk application and it work correctly!
Any ideas about what I made wrong and how to fix this error?
Posted by admin (Graham Ellis), 24 September 2005I think the problem is that you have your command name and parameters all in the same variable that's passed into the exec, so that your program is looking for a command who's name is the entire command line and not just the command name.
Here's an example that I hope clarifies that:
The first section gave an errot message (as per your report) and the second section worked. Here's the output:
Posted by Dimon (Dimon), 26 September 2005Oh, thank you, simple and interesting.
But I have solved this problem by calling that C++ program in separate thread More complex but it's working.
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: email@example.com • WEB: http://www.wellho.net • SKYPE: wellho