借助C程序运行记事本 [英] Run Notepad with help of C program

查看:66
本文介绍了借助C程序运行记事本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
我正在使用Windows平台,我想在C程序的帮助下运行记事本文件.我尝试过的是这里

Hello,
I am working with windows platform, i want to run notepad file with the help of C program. What i tried is here

#include<stdio.h>
#include<conio.h>
#include<process.h>
void main()
{
clrscr();
   system("C:\\windows\\notepad.exe");
   getch();
}




该代码没有错误,但是仍然看不到新的记事本文件.请帮帮我

谢谢&问候
基数:rose:




The code has no errors but still am not able to see a new notepad file. Please help me out

Thanks & regards
Radix :rose:

推荐答案

一个简单的可执行文件,如:

A simple executable like:

#include <stdlib>

int main()
{
    system( "notepad" );
}



在VC ++ 2005和XP上对我有效.如果您以同一用户身份打开命令提示符,则您正在运行C程序,是否可以仅通过键入"notepad"来调用记事本?

干杯,

Ash



works for me on VC++2005 and XP. If you open a command prompt as the same user you''re running your C program as can you invoke notepad just by typing "notepad"?

Cheers,

Ash


我认为ShellExecute是C API,而不是C ++.
I thought that ShellExecute was a C API, and not a C++ one.


我在PC上尝试过您的代码,它可以正常工作.您指定了记事本的完整路径:您确定它是正确的吗?
I tried your code on my PC and it works properly. You specified the full-path of notepad: are you sure that it is correct?


这篇关于借助C程序运行记事本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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