Problem writing int to binary file in C

前端 未结 6 2152
一整个雨季
一整个雨季 2021-01-06 21:11

I need to write data to a binary file using C\'s I/O functions. The following code causes a runtime exception :


#include \"stdio.h\"

int main(int argc,char         


        
6条回答
  •  旧时难觅i
    2021-01-06 22:00

    I also faced this kind of problem. So this is my solution.

    fwrite(val, sizeof(val[0], sizeof(val)/sizeof(val[0]), fp);

提交回复
热议问题