未知类型的bug--bug1

来源:互联网 发布:慢跑 知乎 编辑:程序博客网 时间:2024/05/07 09:48
    c com[comset];    int comsetcount;    for (comsetcount = 0; comsetcount < 50; comsetcount++) {        com[comsetcount].computerset = comsetcount + 1;        int statecount = 0;        for (; statecount < 6; statecount++) {            com[comsetcount].state[statecount] = 0;        }    }    FILE *coma;    coma = fopen("com.txt", "w");    fwrite(com, sizeof(c), 50, coma);    fclose(coma);    FILE *fp;    c comtest[50];    fp = fopen("com.txt", "r");    fread(comtest, sizeof(c), 50, fp);    fclose(fp);    int i;    for (i = 0; i < 50; i++)        printf("%d\n", comtest[i].computerset);

输出:1
2
….
25
-858993360
-858993360
无语法错误,谁能告诉我,为什么?泪。。。。。

0 0