Home > Back-end >  Fish oil daily for help
Fish oil daily for help

Time:09-17

#include
# include
# include
The main ()
{
The FILE * fp.
Char STR [50], filename [50];
Printf (" string ");
Gets (STR);
Printf (" file: ");
The scanf (" % s ", filename);
If ((fp=fopen (filename, "w")!=NULL))
{
The fputs (STR, fp);

The fclose (fp);
}
}
1> W: \ C code \ Project1 \ source. 40 (12) C: warning C4047: "=", "FILE" * "and" int "indirect level of different
1> W: \ C code \ Project1 \ source. C (11) : warning C4996: 'the scanf' : This function or variable may be unsafe. Consider using scanf_s home. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See the online help for details.
1> W: \ C code \ Project1 \ source. (12, 14) C: warning C4996: 'fopen' : This function or variable may be unsafe. Consider using fopen_s home. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See the online help for details.
1> Project1. Vcxproj - & gt; W: \ C code \ Project1 \ Debug \ Project1 exe
1> Generating project has been completed "Project1. Vcxproj" operation,
==========: one success and failure zero, zero, latest skip 0==========
String: hapy, happy
File: happy. TXT

W: \ C code \ Project1 \ Debug \ Project1 exe process (10044) have withdrawn, code - 1073741819,
Press any key to close this window...

Don't know is what reason, also won't change it for

CodePudding user response:

 if ((fp=fopen (filename, "w")!=NULL)) 

To the following:
 if ((fp=fopen (filename, "w"))!=NULL) 


Note the position of the brackets,
Because! Higher priority==

CodePudding user response:

Thank you very much! Every back to help me solve the problem! I don't know how to thank you!

CodePudding user response:

What a shame was the same question twice ~! ~ ~!

CodePudding user response:

Why there has been nothing TXT file

CodePudding user response:

The
reference 4 floor m0_46570923 reply:
why TXT file has been nothing

Changed after the problem, and then run to see you again after input file

CodePudding user response:

refer to 6th floor N - N - N response:
if no changes have options of w and other then if can't open to create a new

??????????
  • Related