title: Object passing using Pipes in C++
body: <pre><code>class Proc
  {
  public:
      string schedulingAlgo;
      string procName;
      int quantum;
      int arrivalTime;
      int burstTime;
  }
  </code></pre>
  
  <p>This is my class whose object i want to pass to another process using pipes using the write sys call</p>
  
  <pre><code>write(fd_admit_write,(char*)&amp;procs, sizeof((char*)&amp;procs));
  </code></pre>
  
  <p>And in the other process, I am trying to read this and convert it back into the Proc type using this</p>
  
  <pre><code>char buffer[15];
  read(fd_admit_read,buffer,15);
  Proc *pp = reinterpret_cast&lt;Proc *&gt;(buffer);
  </code></pre>
  
  <p>I know that the method I used for conversion is fine because I tried it independently but when I use it in pipes, the output of <strong>pp</strong> gets distorted.</p>