代码较长请耐心看并理解
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
FILE *fp;
char str[80],ch;
int rtvl[20]={
0},i; //定义返回值
if((fp = fopen("text","w+")) == NULL)
{
printf("The file text was not opened\n ") ;
exit(-1);
}
else
{
rtvl[0