title: How to get the PID of a process in Linux in C
body: <p>I need to kill a process using the kill API. For that I need the process id of the process. I tried to get it using:</p>
  
  <pre><code>ret = system("pidof -s raj-srv");
  </code></pre>
  
  <p>but it is not returning the correct value. I dont want to kill the process using this:</p>
  
  <pre><code>ret = system("pkill raj");
  </code></pre>
  
  <p>Is there any API that could be used to get the process id?</p>