如何在程序结束时导出程序创建的文件? [英] how can I export a file created by the program at the end of program?

查看:76
本文介绍了如何在程序结束时导出程序创建的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想导出最后由当前程序创建和填充的文件。它是一个日程文件,程序会写它的作用。我用 fopen 打开一个文件,并在程序中写下我正在做的事情。当我在终端gedit file.c上输入时它会显示我的文件,但程序应该为我输入而不是我自己。



主要问题是我正在创建桌面上的logFile,最后我希望程序自动向我显示该文件。我不想获取路径并单击该文件打开它。我希望程序自动导出它。我应该使用哪种方法?

解决方案

感谢大家。我找到了解决方案。

  int  main( int  argc, char  * argv [])
{
system( gedit hello.c);

return 0 ;
}


这个也有效。

 execlp(/ usr / bin / gedit中, gedit中, 的hello.c,NULL); 


I want to export a file created and filled by the current program at the end.Its a log file that program writes what it does. I open a file with fopen and writing what I am doing in the program. when I type on terminal "gedit file.c" It shows me the file but program should type it for me not myself.

The main problem is that I am creating a logFile in desktop and at the end I want program to show me that file automaticly.I dont want to get the path and click on the file to open it.I want program to export it automaticly. which method should I use?

解决方案

Thanks to you all. I have found the solution.

int main(int argc,  char *argv[]) 
{
   system("gedit hello.c");

   return 0;
}


This one works too.

execlp("/usr/bin/gedit","gedit","hello.c",NULL);


这篇关于如何在程序结束时导出程序创建的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆