Home > Back-end >  Great god solve why my vs2019 written by C language code to open the file on the screen or notepad s
Great god solve why my vs2019 written by C language code to open the file on the screen or notepad s

Time:12-21

My code please help see
# include & lt; stdio.h>
Int main (void)
{
char ch;
The FILE * fp, * fpout;
Errno_t err, err1;

Err=fopen_s (& amp; Fp, "C: \ \ Users \ \ 13405 \ \ Desktop \ \ test \ \ wacky TXT", "r");
Err1=fopen_s (& amp; Fpout, "C: \ \ Users \ \ 13405 \ \ Desktop \ \ test \ \ xieru TXT", "w +");
While ((ch=getc (fp)!='#'))
{
Putc (ch, fpout);
}
fclose(fp);
The fclose (fpout);
return 0;
}



open effect

CodePudding user response:

Write code, give you some Suggestions on
1. Be sure to do error checking, don't be frightened by this trouble.
Err, err1 return values are right
?
2. The code must be easy to understand,
 ((ch=getc (fp)!='#') - & gt;> ((ch=getc (fp))!='#') 


3. Learn to write debugging code, determine the cause of the failure,
When an error occurs, for example,
The file open error, or read the error of the characters, or the file is written to error

4. Felt like gibberish, look at the function way of using the website,
You the content of the input file is in English or Chinese, is Chinese,
Try to use English first, if use, try in Chinese,
How feel putc function problems, are not familiar with the function of VC,
] https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/fopen-s-wfopen-s? View=MSVC - 160

CodePudding user response:

references in smoke past 1/f, 0819 response:
write code, give you some Suggestions on
1. Be sure to do error checking, don't be frightened by this trouble.
Err, err1 return values are right
?
2. The code must be easy to understand,
 ((ch=getc (fp)!='#') - & gt;> ((ch=getc (fp))!='#') 


3. Learn to write debugging code, determine the cause of the failure,
When an error occurs, for example,
The file open error, or read the error of the characters, or the file is written to error

4. Felt like gibberish, look at the function way of using the website,
You the content of the input file is in English or Chinese, is Chinese,
Try to use English first, if use, try in Chinese,
How feel putc function problems, are not familiar with the function of VC,
] https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/fopen-s-wfopen-s? View=MSVC - 160
bosses have no problem on this operation finally also directly generate written statement in English in the TXT file is displayed is a bunch of boxes

CodePudding user response:

references in smoke past 1/f, 0819 response:
write code, give you some Suggestions on
1. Be sure to do error checking, don't be frightened by this trouble.
Err, err1 return values are right
?
2. The code must be easy to understand,
 ((ch=getc (fp)!='#') - & gt;> ((ch=getc (fp))!='#') 


3. Learn to write debugging code, determine the cause of the failure,
When an error occurs, for example,
The file open error, or read the error of the characters, or the file is written to error

4. Felt like gibberish, look at the function way of using the website,
You the content of the input file is in English or Chinese, is Chinese,
Try to use English first, if use, try in Chinese,
How feel putc function problems, are not familiar with the function of VC,
] https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/fopen-s-wfopen-s? View=MSVC - 160
bosses me this operation do not have what problem is generated by the TXT file using notepad to open the show is a string of box I put the output flow to the display screen is also a string of box
This is why ah

CodePudding user response:

references in smoke past 1/f, 0819 response:
write code, give you some Suggestions on
1. Be sure to do error checking, don't be frightened by this trouble.
Err, err1 return values are right
?
2. The code must be easy to understand,
 ((ch=getc (fp)!='#') - & gt;> ((ch=getc (fp))!='#') 


3. Learn to write debugging code, determine the cause of the failure,
When an error occurs, for example,
The file open error, or read the error of the characters, or the file is written to error

4. Felt like gibberish, look at the function way of using the website,
You the content of the input file is in English or Chinese, is Chinese,
Try to use English first, if use, try in Chinese,
How feel putc function problems, are not familiar with the function of VC,
] https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/fopen-s-wfopen-s? View=MSVC - 160
I changed my good thank you for your mention point
Learn from your bosses give you suggestion is very nice
  • Related