title: Synchronization in C with system calls
body: <p>I am doing something a bit weird but i want it fully synchronized. So i thought of asking your help. I have the following:</p>
  
  <pre><code>printf("My name is:");
  system("echo syntax_Error");
  printf("I am 17 yrs old\n");
  </code></pre>
  
  <p>this is quite abstract instead of echo I am executing a software that gives me an output, so execution time is unpredictable, but the order is the same. I want a printf then system call then printf such that they would come aligned as such</p>
  
  <blockquote>
    <p>My name is syntax_Error I am 17 yrs
    old\n</p>
  </blockquote>
  
  <p>I tried this order without locks but it didn't work which is quite obvious, or if it did sometimes it is unpredictable. I am new to synchronization structures so I would like your input.</p>
  
  <p>cheers!=)</p>