473,387 Members | 1,530 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

how to call notepad.exe from a c program


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
7 7440
i don't think you can do that...

Dec 17 '05 #2
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
-----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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: aa | last post by:
I write to a text file, and when view the resulting file in Notepad, it shows "\t" as tabs correctly, but "\n" does not break the line. Instad it shows as a square. In Dreamweaver it shows OK....
4
by: Jesper | last post by:
How can I open a textfile from C# using notepad (or the user assigned application for this).
1
by: Galaxia | last post by:
Hi, I am using C# of VS .Net 2003. I want to call another executable file (.exe) in my program. How can I do it? Thanks. -- "Forward Galaxia"
13
by: Chris Johnson | last post by:
I have what seems to be such a simple thing yet I cannot figure out how to do it. I am using a streamwriter to build a text file. At the end of the process I want to open that same text file in...
3
by: forest demon | last post by:
for example, let's say I do something like, System.Diagnostics.Process.Start("notepad.exe","sample.txt"); if the user does a SaveAs (in notepad), how can i capture the path that the user...
7
by: Sheikko | last post by:
Hi all, i have an application and i wan to call another program into it, like notepad, so when i minimize the notepad, or maximize, it must rest in my application. thank you
6
by: sanjayhpatel2000 | last post by:
Hi Everybody, I am new to Python and also new to Notepad++. Can any one help to code my first python program in Notepad++. I am already doing it in python interpretor, but now i was to do in...
36
by: Don | last post by:
I wrote an app that alerts a user who attempts to open a file that the file is currently in use. It works fine except when the file is opened by Notepad. If a text file is opened, most computers...
35
by: jleslie48 | last post by:
I've written a cgi program in C using the borland 5.5 free compiler, and it runs just fine on an Apache server. My only issue is if I issue some system calls the cgi suspends until the call...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.