title: run linux command asynchronously with callback in c++
body: <p>I am trying to write a c++ program that will run linux commands asynchronously and register a call back for the return values of the linux command. what I exactly want is to write a utility function to which I will pass two parameter one is linux command and other one is callback.</p>
  
  <p>when We call this utility function, it should not block the program and continue the execution of program. but once the linux commands executed it will invoke the callback that we pass as second parameter. </p>
  
  <p>I have tried c++ system() function. and have tried boost.process headers to run 
  the linux commands. but they are all blocking way of calling linux calls.from c++. </p>
  
  <p>I am new to to this type of async + callback register type of programming. </p>
  
  <p>The program should exactly look like the one I have tried in node.js programs that I use in my node.js programs. which works very well for me the link that I follow for this is <a href="http://www.dzone.com/snippets/execute-unix-command-nodejs" rel="nofollow">http://www.dzone.com/snippets/execute-unix-command-nodejs</a></p>
  
  <p>Please help me to get this done in c++. what improvements i need to do in c++ system call that run perfectly for me but is blocking. or do we have some direct facility available in C++ or boost library. </p>
  
  <p><strong>NOTE: I am using g++ 4.3 compiler. it is not C++0x or C++11.</strong> </p>
  
  <p>Thanks,
  Abhishek</p>