where logic error line files
#include <stdio.h>
#define MAXDIG 50
void main() {
FILE *f;
int j, i = 0;
char dig[MAXDIG];
if ( !(f = fopen("H:\1\first", "r")) ) {
printf("error opening file\n");
}
while (!feof(f)) {
fscanf(f, "%c\n", &dig[i开发者_C百科++]);
if (i >= MAXDIG)
break;
}
for (j=0; j < i; j++)
printf("%c\n", dig[j]);
}
must show line, why it not (where error)? my workspace eclipse. sorry bad english. with new year
You will need to escape backslashes in your filename:
fopen("H:\\1\\first", "r")
精彩评论