用C++制作一个exe文件,他能读取文件(方式如下):
最后程序就能读取他了(类似.pptx被Microsoft Powerpoint读取、.docx被Microsoft Word读取一样),但不一定要有GUI。
你知道 t 这种文件的格式的话就是一带参数的main程序,你网上找带参数的C++程序例程
这种文件的关联可以在Windows里手动操作,像你图中的
也可以在程序里修改注册表
int main(int argn, char* args[])
{
cout << args[1] << endl;
if (argn < 2){
cout << "need a param"<< endl;
}
ifstream of;
of.open(args[1]);
if (!of.is_open()) {
cout << "open file failed" << endl;
}
//读取文件
stringstream buf;
buf << of.rdbuf();
cout << buf.str();
system("pause");
return 1;
}
编译好后能实现你那种效果