Solved

invoking other programs

Posted on 1998-11-24
4
172 Views
Last Modified: 2010-04-01
I want to write a program that would invoke other commands on the system (ex: dir (dos) or ls(unix)). Can someone give me a hint on how to get this done? Thanks in advance.
0
Comment
Question by:ken2
  • 2
  • 2
4 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 50 total points
ID: 1178593
The only portable way is to use the system() function which is part of the C run-time library.  There are some non-portable ways that may provide you with more control/options however.

Let me know if you have questions.
0
 
LVL 86

Expert Comment

by:jkr
ID: 1178594
Hi nietod - you're typing fast ;-)
Well, this usually can be done using the 'system()' command.
However, if you specialize on a certain platform (e.g. UN*X, NT, Win9x) there are eventually more sophistcated wayd to do this (NOTE: 'dir' in DOS is a built-in shell command, you'll have to use the command line 'command.com /k dir').
0
 
LVL 22

Expert Comment

by:nietod
ID: 1178595
>> Hi nietod - you're typing fast ;-)
Quit complaining.  I was gone for 4 days, you had ample time to make it to the top.  : - )
0
 
LVL 86

Expert Comment

by:jkr
ID: 1178596
nietod - did i complain <lol> ?
Not at all!!! ;-)
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now