/* Opens a named pipe for writing and writes int values 
   to it (unsynchronized).
   Written by Andre M. Maier, dhbw@andre-maier.com */
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char** argv)
{
   char* named_pipe="/tmp/mypipe";
   mkfifo(named_pipe,0666);
   int count=0;
   while(1)
   {
      int fd=open(named_pipe,O_WRONLY);
      char str[12];
      sprintf(str,"%d\n",count);
      write(fd,str,strlen(str));
      sleep(1);
      count++;
      close(fd);
   }
   return 0;
}

