注:此代码只适用于同一文件夹内操作,只是学习用代码,轻喷。
#include<stdio.h>
void sort(int a[],int n)
{
int i,j,t;
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if(a[j]>a[i])
{
t=a[i];
a[i]=a[j];
a[j]=t;
}
}
}
}
int main()
{
FILE * txt_1=fopen("num1.txt","r");
FILE * txt_2=fopen("num2.txt","r");
FILE * txt_3=fopen("num3.txt","w");
/*
FILE * fopen(const char * path,const char * mode);
参数path字符串包含欲打开的文件路径及文件名,
参数mode字符串则代表着流形态。
mode有下列几种形态字符串:
“r” 以只读方式打开文件,该文件必须存在。
“w” 打开只写文