Using printf from two processes simultanously can be dangerous (stdio isn't necessarily re-entrant). I'd recommend using kprintf and debug.lib (sas/c) or libdebug.a (gcc).
- What's the point in having the command executed with CreateNewProc if it only returns when it finishes anyway ?
CreateNewProc creates new process that runs 100% asyncronous from the parent. CreateNewProc returns as soon as the subproc has been launched, it does not wait for it to finish. Be careful to sync the start and exit or you will have random problems.
Here's an example of subprocess and IPC:
http://www.iki.fi/sintonen/src/ipc/