I'm trying to copy text from a input.txt but programs thinks spaces are new lines. How should I go about this?
my input.txt (trial)
1. hero
2. angelic
3. hello world
4. demons
my source.c
int main(void) {
FILE* fread = fopen("C:\\Users\\EXAMPLE\\desktop\\input.txt", "r");
if (fread == NULL) {
printf("One file wouldn't open!\n");
return -1;
}
//this pastes the text from input.txt into the command-line
char line[1000] = "";
while (fscanf(fread, "%s", line) == 1) {
printf("%s\n", line);
}
fclose(fread);
fclose(fwrite);
output
1.
hero
2.
angelic
3.
hello
world
4.
demons