john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

pipe end

/* John Pfeiffer 21nov07    Demo of how to read piped data - 2nd, read data*/
/* usage: pipe-start.c.exe | pipe-end.c.exe */

#include <stdio.h>

int main(int argc, char* argv[])
{   
    int i=0;
    char c, temp[1024];

    c = getchar();
    printf("\nReceiving...\n");
    while( c != EOF )
    {
        printf("%c",c);
        temp[i] = c;
        i++;
        c = getchar();        
    }
    i++;
    temp[i] = '\0';
    printf("\nI have been piped\n%s",temp);
    return 0;
}

  • « pipe start
  • file compare »

Published

Nov 21, 2007

Category

c

~49 words

Tags

  • c 95
  • end 1
  • pipe 4