By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,305 Members | 1,619 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,305 IT Pros & Developers. It's quick & easy.

how to call notepad.exe from a c program

P: n/a

hi

i'm working on project.in that i have 2 call notepad.exe. i want to
know how to call notepad.exe from a c program in unix environment
--
kisshug
Message posted via http://www.exforsys.com for all your training needs.

Dec 17 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
i don't think you can do that...

Dec 17 '05 #2

P: n/a
kisshug <ki************@no-mx.forums.yourdomain.com.au> writes:
i'm working on project.in that i have 2 call notepad.exe. i want to
know how to call notepad.exe from a c program in unix environment


The only portable way to invoke a program from C is via the system()
function. See your documentation for details ("man system" if you're
on a Unix system). If that doesn't work, you'll need to ask in a
newsgroup for your system.

<OT>
However, notepad.exe is normally a Windows program; how do you expect
to invoke it from Unix?
</OT>

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Dec 17 '05 #3

P: n/a
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

kisshug wrote:
hi

i'm working on project.in that i have 2 call notepad.exe. i want to
know how to call notepad.exe from a c program in unix environment


Are you /sure/?

If you are working in a Unix environment, then you likely /do not/ want to
invoke NOTEPAD.EXE (which is a Microsoft Windows application, and not a Unix
application).

However, if you are /certain/ that you want to invoke "notepad.exe", code

system("notepad.exe");

into your program.

- --
Lew Pitcher

Master Codewright & JOAT-in-training | GPG public key available on request
Registered Linux User #112576 (http://counter.li.org/)
Slackware - Because I know what I'm doing.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.7 (GNU/Linux)

iD8DBQFDo5naagVFX4UWr64RAkUdAKD230xn6vVMnkB+k3dwJO Qhfgrh6wCfYtqd
NvYb8iJvGEmaVjD7Vuzbl+Y=
=JDNx
-----END PGP SIGNATURE-----
Dec 17 '05 #4

P: n/a
pank7 wrote:
i don't think you can do that...


Cannot do WHAT? Please provide context, there is no guarantee that any
one else has seen the post you are replying to. See
http://cfaj.freeshell.org/google/ for details.

In any case, I happen to know that, if you do things in the right way,
there are multiple possible ways of running "notepad.exe" on a Unix
environment, so please redirect people to appropriate groups when they
ask off topic questions rather than trying to answer them here.

Because of the fundamental problems in trying to do what the OP wants,
if the OP *really* wants to run notepad.exe, the OP needs to go to a
group for his/her system, and possibly look at wine.
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.
Dec 17 '05 #5

P: n/a
kisshug wrote:
hi

i'm working on project.in that i have 2 call notepad.exe. i want to
know how to call notepad.exe from a c program in unix environment


On my Linux machine, this works:

#include <stdlib.h>

int main(void)
{
system("notepad");
return 0;
}

The reason it works is because Wine is installed, and it installed a
shell script as '/usr/bin/notepad' that runs:
/usr/bin/wine notepad.exe

The notepad.exe file is actually located in
/home/sbiber/.wine/drive_c/windows/notepad.exe

Perhaps you need to install Wine.

--
Simon.
Dec 17 '05 #6

P: n/a
kisshug a écrit :
i'm working on project.in that i have 2 call notepad.exe. i want to
know how to call notepad.exe from a c program in unix environment


system() is your friend, but are you kidding ? notepad.exe is a Windows
application. You can't call it from a unix one.

What the hell are you trying to achieve ?

--
A+

Emmanuel Delahaye
Dec 17 '05 #7

P: n/a
Emmanuel Delahaye wrote:
kisshug a écrit :
i'm working on project.in that i have 2 call notepad.exe. i want to
know how to call notepad.exe from a c program in unix environment
system() is your friend,


True.
but are you kidding ?
I agree it is a bad idea.
notepad.exe is a Windows
application.
True.
You can't call it from a unix one.
False. I've had Unix type systems set up so that if you typed
"notepad.exe" at the command line from the standard shell it would,
indeed, laung the Windows version of notepad.
What the hell are you trying to achieve ?


A sensible question.
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.
Dec 17 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.