c language:make fgets to keep taking input until I press enter twice?
Posted
by wello horld
on Stack Overflow
See other posts from Stack Overflow
or by wello horld
Published on 2010-04-29T05:32:00Z
Indexed on
2010/04/29
5:37 UTC
Read the original article
Hit count: 136
c
hi I would like to ask how I would modify this code for the question: (It only accepts one input then prints it out. I want it to keep going until I hit enter (\n) twice.
#include <stdio.h>
#define MAXLENGTH 1000
int main(void) {
char string[MAXLENGTH];
fgets(string, MAXLENGTH, stdin );
printf("%s\n", string);
return 0;
}
I'm confused at the fgets(string, MAXLENGTH, stdin ); line, what does stdin mean/do?
© Stack Overflow or respective owner