小编Anh*_*ran的帖子

文件访问模式"w"和"wb"的区别

这些代码块之间有什么不同.我试图搜索"wb",但没有在任何地方看到它.包含"wb"的文件来自我的导师

FILE *f = fopen(DB_FILE_NAME, "wb");
    if (f == NULL) {
        printf("Write error\n");
    } else {
        /* write n_students elements of the studentlist array */
        fwrite(studentlist, sizeof(student_t), n_students, f);
        fclose(f);
    }  
Run Code Online (Sandbox Code Playgroud)

FILE *f = fopen(DB_FILE_NAME, "w");
    if (f == NULL) {
        printf("Write error\n");
    } else {
        /* write n_students elements of the studentlist array */
        fwrite(studentlist, sizeof(student_t), n_students, f);
        fclose(f);
    }
Run Code Online (Sandbox Code Playgroud)

c file mode access

8
推荐指数
3
解决办法
2万
查看次数

标签 统计

access ×1

c ×1

file ×1

mode ×1