Mail Archives: djgpp/1996/05/30/14:47:51
From: <rkwcvdz AT rivier1 DOT puk DOT ac DOT za>
Date: Wed, 29 May 96 09:01:36
#include <stdio.h>
int main(void);
void exit(int);
int main(void)
{
int c;
File *fin, *fout;
^^^^
Here is your problem. The typedef is FILE not File. This should be:
FILE *fin, *fout;
fin = fopen("in.dat", "r");
if (fin == NULL) {
printf("Unable to open file in.dat\n");
exit(1);
}
fout = fopen("out.dat", "w");
if (fout == NULL) {
printf("unable to open file out.dat\n");
exit(2);
}
while ((c=fgetc(fin)) != EOF) {
if (fputc(c, fout) != c) {
printf("Error writing out.dat\n");
exit(3);
}
}
fclose(fin);
fclose(fout);
return 0;
}
--
Art S. Kagel, kagel AT quasar DOT bloomberg DOT com
A proverb is no proverb to you 'till life has illustrated it. -- John Keats
- Raw text -