#include <stdio.h>
int main() {
int c;
while ((c = getchar()) != EOF) {
putchar(c);
}
}
This works fine, when EOF ( ctrl + z) is in a new line, but when the input
is :
blabla^z
it does not work.
When i debug the program it tells me that the input "^z"(^z = EOF) is saved as 26,
but when the input ^z is in a new line it is saved as -1.
Why?
in case something is unclear:
it is saved in the variable c, and does not work means it doesnt terminate the while loop, only when the input ^z is put in a new line it tearminates the loop
im using windows