#include int main() { FILE *fp; char line[80]; /* Open our device to read*/ fp = fopen("/dev/virtual_device", "r"); if(fp==NULL) { printf("Error: can't access virtual device\n"); return 1; } /* read a line from it */ fgets(line,80,fp); printf("%s\n", line); /* close the device */ fclose(fp); /* Open our device to write*/ fp = fopen("/dev/virtual_device", "w"); if(fp==NULL) { printf("Error: can't access virtual device\n"); return 1; } /* try to actually write something */ fprintf(fp,"Testing ............. !!!!!!!!!!!!"); /* close the device */ fclose(fp); return 0; }