#include int main(int argc, char **argv) { FILE *f; if(argc>1){ char buf[256]; sprintf(buf,"%s/%s",getenv("PWD"),argv[1]); f=fopen(buf,"r"); } else f=stdin; setvbuf(stdin,NULL,_IONBF,0); setvbuf(stdout,NULL,_IONBF,0); char c; printf("-- reading from file byte by byte --\n\n"); while(fread(&c,1,1,f)) { printf("%c",c); } printf("\n-- no more data on this file --\n"); return 0; }