Is there a way to make a program run in the background?
Because every program i make pop ups the console.
Is there a way to make a program run in the background?
Because every program i make pop ups the console.
Okey i'll look it up.
So in *nix it isn't possible? :O
*nix systems it's possible, too, but offhand I believe for Windows it can be done if you use CreateProcess() to start a new process. Otherwise, for Windows.... you need to make your program as a "real" Windows program, and not a console program. That way starting it up will start up as a Win32 Windows process that handles its own message loop and such. If you decide you need a console later on, I think you can call AllocConsole() and set the streams so printf() and the like will print to it.
If this is all too complicated, you can just call FreeConsole() from your Windows console program and it'll ditch the console.
Oh it's a lot easier in Unix/Linux
myprog &
Job done.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
but that's from a shell, not an API.
In which case, fork() and exec() are your friends.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.