Originally Posted by
hqt
But, hmmm, sorry, maybe I have another questions please (just for learning purpose), that I want to know, how can do this(read a whole line) in C. (because, in C, there no iostream and string library).
I have one solution use fget(), to take each character and processing it, but I think it isn't beautiful so much. So, who know this problem, tell me, please.
thanks for tons
You would use fgets:
Code:
#include <stdio.h>
#define BUFSIZE 50
int main(void){
char line[BUFSIZE];
printf("Enter a line: ");
/*in C you would use fgets*/
fgets(line,BUFSIZE,stdin);
printf("You entered: %s",line);
return(0);
}