I want to read some user input and do something with each input. I do that using this code:
char c;
while(1){
printf("input");
c = scanf ( "%s", &c ) ;
}
This works fine . But I need it to accept even an empty input. But it just continues to next line and expects an not-empty input. How could I do that?
Current situation:
input:asdf
input:b
input:c
input:d
input:e
input:
fjhkjh
Expected :
input:asdf
input:b
input:c
input:d
input:e
input:blabla
input:f
input:
input:
Just how the cmd console works like... UPDATE: I don't read only one single charcater, that was an example
%cinstead of%s, and to get a simplecharis better to use getchar and print with putchar, declarecasintchar c[3];//or more..fgets(c, sizeof c, stdin);c = getchar()it will print aninput:for each charcater introduced on the line before...