aks1232001 0 Report post Posted April 14, 2006 Hi Guys!this is a wonderful place.. although i wasnt a member till now i have referred to these forms quite a few times for my programming solns My problem is ::: I am writing a Code in C using Bloodshed Dev C++ 4.9.9.2 on Windows XP. I wanted to open an executable file from my code. After using the solution mentioned on these forums, I used system("myprg");It works fine.. But the prob is that i want my C program to execute this command and then return to the next statement without waiting for me to close the program "mrprog.exe"..Right now wat happens is suppose my code is:system("myprog.exe");printf("Hello World"); ""Hello World" isnt printed on the screen till i exit the program myprog.exeIs there any function that can do this job???Kindly help me plz!Thanx Share this post Link to post Share on other sites
WindAndWater 0 Report post Posted April 14, 2006 As far as I know the only way to do what you want properly is to use threads and the fork and wait functions. Implimenting it is non-trivial, but if you really need to be able to do it, do a search for c, threads, and fork on google. You'll need to download an extra library and learn about interrupts. Alternatively, if you're running linux you might be able to get away with system("myprg &"); Share this post Link to post Share on other sites
beeseven 0 Report post Posted April 15, 2006 On Windows then you should be able to use the command "start." I'm not sure if it would work in this context, but it does in command prompt- usually if you start a program or batch file, it does the same thing that you're talking about, but start runs it independently. This is what I would do: system("start /D. /B myprg");/D. is the path, so if it's in a different directory, use /D"path to its directory"/B says not to make a new window. If it's a text based thing then take that out. Share this post Link to post Share on other sites
aks1232001 0 Report post Posted April 30, 2006 Thanks a Zillion for the help guys <_<I will try out ur instructions n tell u if it works..I'm keeping my fingers crossed!!! Share this post Link to post Share on other sites
aks1232001 0 Report post Posted April 30, 2006 It works!!!!!!!!!!!!!!!!!!!!!!!! well i tried system("start /D. /B myprg");N it worked to perfection...Thanks a lot Beeseven n Windandwater But there is a small new problem..In my code written in C using Dev C++ created by Bloodshed (OS: Windows XP)i want to access the serial ports.. I.e send data to them in order to control a motor that is connnected to my computer...I know its easy to do that in win16 using turboC and function outportb()...but in win32 (i.e Dev C++) how do i do it???I read some info on stuff like win API but a newbie like me found it really really confusing to do it..are there any simples functions like outport() which i can use in my compiler???Thanx a lot for all the help guys!Eagerly awaiting ur reply Share this post Link to post Share on other sites