473,386 Members | 1,668 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,386 software developers and data experts.

system question

I'm writing a little c program and one of things I'm trying to get it to do
is cd to a particular directory and then run an exe that is on my path, as
follows...

strcpy(working_string, "c:\\davedata\\bats\\ks.exe fnord");
system("cd \\playtime\\d\\build\\html");
system(working_string);

But ks.exe does not seem to be invoked on the files in the
\\playtime\\d\\build\\html directory.

Can someone tell me how to do this?
Nov 14 '05 #1
3 1369
David Schwartz <da*******@hotmail.com> wrote:
I'm writing a little c program and one of things I'm trying to get it to do
is cd to a particular directory and then run an exe that is on my path, as
follows... strcpy(working_string, "c:\\davedata\\bats\\ks.exe fnord");
system("cd \\playtime\\d\\build\\html");
system(working_string); But ks.exe does not seem to be invoked on the files in the
\\playtime\\d\\build\\html directory. Can someone tell me how to do this?


The first invocation of system() creates a shell in which you do the 'cd'.
Then the shell exits. As the next step you invoke a completely new shell
by calling system() again that has no idea about the working directory of
the other shell that's already dead. Execute both commands in the _same_
call of system().
Regards, Jens
--
\ Jens Thoms Toerring ___ Je***********@physik.fu-berlin.de
\__________________________ http://www.toerring.de
Nov 14 '05 #2
In <c5************@uni-berlin.de> Je***********@physik.fu-berlin.de writes:
David Schwartz <da*******@hotmail.com> wrote:
I'm writing a little c program and one of things I'm trying to get it to do
is cd to a particular directory and then run an exe that is on my path, as
follows...

strcpy(working_string, "c:\\davedata\\bats\\ks.exe fnord");
system("cd \\playtime\\d\\build\\html");
system(working_string);

But ks.exe does not seem to be invoked on the files in the
\\playtime\\d\\build\\html directory.

Can someone tell me how to do this?


The first invocation of system() creates a shell in which you do the 'cd'.
Then the shell exits. As the next step you invoke a completely new shell
by calling system() again that has no idea about the working directory of
the other shell that's already dead. Execute both commands in the _same_
call of system().


And if your shell doesn't allow this directly, build a script
containing the two commands and execute that script with system().

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 14 '05 #3
David Schwartz wrote:

I'm writing a little c program and one of things I'm trying to
get it to do is cd to a particular directory and then run an exe
that is on my path, as follows...

strcpy(working_string, "c:\\davedata\\bats\\ks.exe fnord");
system("cd \\playtime\\d\\build\\html");
system(working_string);

But ks.exe does not seem to be invoked on the files in the
\\playtime\\d\\build\\html directory.

Can someone tell me how to do this?


Not here. The C language has neither directories nor exes nor
paths. You want a group dealing with your peculiar system, which
I suspect to be either Windows or MsDos.

--
Chuck F (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!

Nov 14 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Abraham Lopez | last post by:
Hi.. Is there a way to convert a System.Array to XML... If you know thanks very much... if you don't... Please do not respond stupid things like " Yes -- many ways."
7
by: MLH | last post by:
Where is system.mdw normally stored in typical A97 installation?
20
by: SR | last post by:
Hi, I need to read the output from a system( ) function within a C program. The function however only returns the exit status. How can I read what system( ) sends to stdout ? (is there a simpler...
4
by: The Spoon | last post by:
I am looking for functions that can be used to automatically update the system date and time on an NT based system, resulting from manually entered date and time values input by an operator via a...
5
by: markus | last post by:
Hi, I have a question that deals with the standard c library VS (Unix) system calls. The question is: which header files (and functions) are part of the C library and which header files (and...
8
by: Richard Lionheart | last post by:
Hi All, I tried using RegEx, but the compiler barfed with "The type of namespace 'RegEx' could not be found. Prior to this, I had the same problem with MatchCollection, but discovered it's...
1
by: Mark Miller | last post by:
I just recently started getting the above error on a page I am posting MULTIPART/FORM-DATA. We have SoftArtisans FileUp component and Filter installed on the server in question and up until a day...
1
by: Sky | last post by:
Yesterday I was told that GetType(string) should not just be with a Type, but be Type, AssemblyName. Fair enough, get the reason. (Finally!). As long as it doesn't cause tech support problems...
10
by: JonathanOrlev | last post by:
Hello everybody, I wrote this comment in another message of mine, but decided to post it again as a standalone message. I think that Microsoft's Office 2003 help system is horrible, probably...
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: 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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.