Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Please tell me how to read and write C language files under Linux. The binary file is ims.bin and the content is FFFFFFFD. How to read the integer variable, that is, the value is -3
Please tell me how to read and write C language files under Linux. The binary file is ims.bin and the content is FFFFFFFD. How to read the integer variable, that is, the value is -3

int?x;

FILE?*fin?=?fopen(...);

fread(&x,?sizeof(int),? fin);

printf("%d",?x);

The general idea is this.

Arrays are also similar: int?a[10];

fread(a,?sizeof(int)*10,?fin);?/*?Note that there is no a in front &?*/