C examples for File:Standard Device
Read Text from the Device File Keyboard and Write It to the Device File Monitor
#include <stdio.h> int main()/*from ww w . ja va 2 s. co m*/ { char text[500]; int m, n = 0, p; puts("Type the text. Strike the function"); puts("key F6 to signify the end of this file."); m = fgetc(stdin); while(m != EOF){ text[n] = m; n = n + 1; m = fgetc(stdin); } puts("Contents of the device-file keyboard are now"); puts("written to the device-file monitor."); for(p = 0; p < n; p++) fputc(text[p], stdout); return(0); }