C语言中 怎么样打开一个文件

Romantic007 2004-11-16 11:07:46
我所说的打开是像windows下双击文件一样的打开,而不是在dos下。
比如 c:\下有个abc.exe和001.txt
我可以用system("c:\\abc.exe");来打开abc.exe
但是不能用system("c:\\001.txt");打开001.txt
我怎么样才能打开非可执行文件呢?
...全文
171 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
fqj2004 2004-11-16
  • 打赏
  • 举报
回复
#include <stdlib.h>
kimmy_zhang 2004-11-16
  • 打赏
  • 举报
回复
我运行了你的程序,但是它说system()是未辨识的标识符!!
怎么回事?
Romantic007 2004-11-16
  • 打赏
  • 举报
回复
没看到上面的程序吗
就是 #include <stdio.h>
^^

谢谢大家的解答
kimmy_zhang 2004-11-16
  • 打赏
  • 举报
回复
system()函数包含在那个头文件里?
本人菜鸟一个,谢谢大虾们
铖邑 2004-11-16
  • 打赏
  • 举报
回复
#include <stdio.h>

main()
{
int i;
FILE *fp;
fp=fopen("d:\\001.txt","w");
fprintf(fp,"%s","gfjjhkhjkhjklhk");
fclose(fp);
system("notepad.exe d:\\001.txt");
}
Romantic007 2004-11-16
  • 打赏
  • 举报
回复
#include <stdio.h>

main()
{
int i;
FILE *fp;
fp=fopen("d:\\001.txt","w");
fprintf(fp,"%s","gfjjhkhjkhjklhk");
system("notepad.exe d:\\001.txt");
}

为什么我打开后是空白?它明明是先写了再打开的嘛
260005065 2004-11-16
  • 打赏
  • 举报
回复
你可以这样:
system("notepad.exe c:\\cmd.txt");

70,023

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧