irst version on that git repo
This commit is contained in:
commit
46ccebf956
13 changed files with 844 additions and 0 deletions
18
stdin.c
Normal file
18
stdin.c
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue