Like in the topic, I'd like to read from standard input and print to standard output whole file with no difference between them.
program < data.txt > data.out
diff data.txt data.out // <- the same
File contains Unicode letters.
I've managed write following piece of code:
char s[100000];
int main()
{
setmode(1, _O_BINARY);
char *n;
do {
n = gets(s);
s[strlen(s)-1] = '\n';
printf("%s", s);
}
while(n);
return 0;
}
but input and output is slighty different (input: 76 465KB, output: 76 498KB)
Thanks in advance.
EDIT:
Now, it's only 2KB difference.
EDIT:
It's OK.