Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using ms-dos based programs 2

Status
Not open for further replies.

Wilber007

Programmer
Aug 15, 2001
13
GB
i am tring to write a bit of code that will execute the ms-dos program windump. i want to invoke the line 'windump > temp.txt'

any1 with some helpful hints?

cheers

Will L
 
The redirection might work as a parameter in ExecuteFile or Shellexecute.

Here are some extracts from one of my apps that does this
Params are other required parameters for this electrical rules checker utility, this sends the output to the file 'ercop.txt'.

const ERCOP = ' > ercop.txt';

Params := Params + ERCOP;
Executefile(addslash(OrcadDir) + 'erc.exe', params, OrcadDir, 1);

If this dosent work (some DOS programs wont accept it)
Write a batch file and include the redierction then call the batch file from your Delphi appliction.

Steve
 
No dos programs recognize I/O redirection syntax. Never pass a redirect to a dos program!

Redirection is handled by the command interpreter, *NOT* the dos program. A program that reads from stdin and writes to stdout will honor redirection established by dos. A program that uses the Crt module normally does not respect the redirection.

In fact, you can fake I/O redirect with some programming at the assembly level. Intercept reads from stdin and writes to stdout and do with them what you will. (I've written a routine that runs a program inside a window on a dos text screen, while simultaneously saving the data to disk.)
 
When you use Shellexecute the paramaters are there in an attempt to simulate the action of the command line interpreter!.
No one is suggesting that You are passing a command to the called program that will make it send it's output to file.

The example I gave is part of a working program! Designed to provide a widows interface to a suite of DOS (and some windows programs) It works fine.

The Redirection should being the 'Stdout' location, if the program being called uses stdout then the redirection will work when called in this way.

Commands in a Batch file invoke the command line interpreter. Redirectons should work as if you had typed it in.

Steve.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top