Home > Back-end >  C how to open, read and write files
C how to open, read and write files

Time:12-24

Like this code, has been failed to open the file, I remember the fopen w is to create a new file, and can conveniently to speak about how to read and write files, thank you

CodePudding user response:

Put the scanf fopen and judgment after fp, the scanf also has a problem, to this:
 the scanf (" % s ", c); 

Give it a try,

Failed to open the file may be related to the scanf, first reverse position, the test, and then change the scanf test,

CodePudding user response:

reference 1/f, confident boy reply:
put the scanf fopen and judgment after fp, the scanf also has a problem, to this:
 the scanf (" % s ", c); 

Give it a try,

Failed to open the file may be related to the scanf, swap places first, test, and then change the scanf test,

Already write the scanf fp judgment after, but direct went out, and create the file failed, the end of the program directly

CodePudding user response:

Copy the example Tan Haoqiang book again, all the,,

CodePudding user response:

refer to the second floor weixin_52907368 response:
Quote: reference 1/f, confident boy reply:
put the scanf fopen and judgment after fp, the scanf also has a problem, to this:
 the scanf (" % s ", c); 

Give it a try,

Failed to open the file may be related to the scanf, swap places first, test, and then change the scanf test,

Already write the scanf fp judgment after, but direct went out, and create the file failed, direct end program

The scanf instead?

CodePudding user response:

Why choose C packing list so sensitive spot?
Suspected authority is not enough,
Looking for individual drive letter written on the play,
  • Related