#include<stdio.h>
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream infile; //以读模式打开文件
infile.open("C:/123.txt"); //打开文件操作
char key_data[100]; //定义一个字符串缓冲区
infile >> key_data; //将读取的文件存放到缓冲区中
infile.close(); //关闭文件
ofstream outfile; //以写模式打开文件
outfile.open("C:/License.ini"); //打开文件
char config_title[100] = "[License]";
char config_date[100] = "Key=";
strcat(config_date, key_data); //字符串拼接
outfile << config_title << endl; //写入文件
outfile << config_date; //写入文件
outfile.close(); //关闭文件
return 0;
}
来源:https://www.cnblogs.com/shenji/p/12509548.html