A.f printf function b. read function C.f write function D.f putc function
CodePudding user response:
Fwrite ah, in the form of a binary "wb" to open the fileCodePudding user response:
B is read, A and D is the character form; So choose C, if C is wrong, that's a problem, that is the wrong answer ~https://wenku.baidu.com/view/f4332ec509a1284ac850ad02de80d4d8d15a01b6.html
CodePudding user response:
[in binary form to store the integer to file] what is the binary form here?If it is 5, for example, in 101 to A file, that's A, using the format of the fprintf print can realize
C can realize bytes stored, but the store content itself is the hexadecimal
CodePudding user response:
C fwrite () functionCodePudding user response:
Can't draw themselves soberAC is ok
A need some skills
CodePudding user response:
Correct ACD will doThere's a trick to AD
CodePudding user response:
Fwrite can be; But I can't stop to the fputc can:Int fputc ( int c, FILE * stream);
CodePudding user response:
I also said fprintf can also, who to bicker with me, I'd drop this few lines of code for him:# include & lt; Stdio. H>
Int main () {
Int I=0 x12345678;
The FILE * f=fopen (" data. Bin ", "wb");
Fprintf (f "% % % % c c c c", (char) (i> 24), (char) (i> 16 & amp; 0 XFF), (char) (i> 8 & amp; 0 XFF), (char) (i& 0 XFF));
The fclose (f);
return 0;
}
CodePudding user response:
Don't put theFopen ("... ", "... "); Fscanf fprintf, the fgets, fgetc fputc, fclose//read the replaced \ r \ n \ n, write to replace the \ n \ r \ n. EOF is read \ x1a set; When the content of the read and write characters see
And
Fopen ("... ", "... "); Fseek, ftell, fread and fwrite, fscanf, fprintf, the fgets, fgetc, fputc, fclose//do not make the above replacement, encounter \ x1a continued to read; When the content of the read and write bytes see
Confused by the
CodePudding user response:
Thank you for your answer!!!!!!