getting 1000 chars at a time from stdin
Hi all,
My program has needs to ask for standard input.. the user can enter a single number (that could be millions of digits long) and i need to get 1000 digits at a time.
Which function should i use? fgets()? but im not sure where i specify the 1000 digit buffer? Here is what i tried, could some one tell me what im doing wrong.
Thank you :)
Code:
#include <stdio.h>
#include <stdlib.h>
int main (int argc , char** argv) {
int buffer[1000];
int current;
while (current = fgetc(stdin) != '\n') {
current = current - '0';
printf("%d", current);
}
return 0;
}