开发者

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")
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜