Two other problems from your code above:
Code:
destination = fopen("//server//folder//filename.txt","w");
if(source==NULL)
{
printf("File error!");
return 1;
}
Do you see a problem?
ch should be an int, not a char. EOF is an integer not a char. An int can contain a char or a full int, such as EOF.
Run the following:
Code:
#include <stdio.h>
int main(void)
{
int ch = 0;
ch = 'a';
printf("Hex: %x, int: %d, char: %c\n", ch, ch, ch);
ch = EOF;
printf("Hex: %x, int: %d\n", ch, ch);
return 0;
}
output:
Code:
Hex: 61, int: 97, char: a
Hex: ffffffff, int: -1