how to call notepad.exe from a c program

K

kisshug

hi

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

Keith Thompson

kisshug said:
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>
 
L

Lew Pitcher

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
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+k3dwJOQhfgrh6wCfYtqd
NvYb8iJvGEmaVjD7Vuzbl+Y=
=JDNx
-----END PGP SIGNATURE-----
 
F

Flash Gordon

pank7 said:
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.
 
S

Simon Biber

kisshug said:
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.
 
E

Emmanuel Delahaye

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 ?
 
F

Flash Gordon

Emmanuel said:
kisshug a écrit :

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top