#include #include void read_from_stdin(){ char *buff=malloc(1); int bytes; //making a new variable to store value returned by fread, to stop when needed. while((bytes=(fread(buff,1,1,stdin)==1))) { //read from stdin, to buff, saving return code to see if fread had read any bytes, if yes, we'll get 1 if not, then something else we don't need to care about if(!feof(stdin)){ printf("%c",*buff); } else{ return; } } free(buff); return; }