title: C Pipe communicating write/read function cuts of text
body: <p>The write or read function always cut of everything except the first letter. anyone knows why?
  I have a father and a child that communicating with pipes.
  I checked tha variable before putting it into write and it wasnt cutted of .</p>
  
  <pre><code>#include&lt;dirent.h&gt;
  #include&lt;string.h&gt;
  #include&lt;stdio.h&gt;
  #include&lt;stdlib.h&gt;
  #include&lt;unistd.h&gt;
  #include&lt;time.h&gt;
  
  int main(int argc, char *argv[])
  {
      time_t tm_now;
      struct tm *ptm_now;
      time(&amp;tm_now);
      ptm_now = localtime(&amp;tm_now);
  
      int chanal_father[2];
      int chanal_child[2];
      pipe(chanal_father);
      pipe(chanal_child);
      char message_child[50];
      char message_father[50];
      char message_return[50];
  
  
      if (fork()==0)
      {
          read(chanal_father[0], message_father, strlen(message_father)+1);
          if(strcmp(message_father, "day") == 0) {
              int day = ptm_now-&gt;tm_mday;
              int month = (ptm_now-&gt;tm_mon)+1;
              int year = (ptm_now-&gt;tm_year)-1900;         
              sprintf(message_return, "%2d.%2d.%2d", day, month, year);
          }
          else {
              sprintf(message_return, "unknown function!");
          }
  
          write(chanal_child[1],message_return, strlen(message_return)+1);
          exit(0);
      }
  
      write(chanal_father[1], argv[1], strlen(argv[1])+1);
      read(chanal_child[0], message_child, strlen(message_child)+1);
      printf("%s\n", message_child);
  }
  </code></pre>