Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Does anyone know how to get the output of a dos program. That way it can be used as data for another program.

command > file
or
command >> filee.g.:
dir > out.txt
or
dir >> out.txtUsing two greater-then signs will APPEND the output to the file (will preserve previous data from file).
Using only one will "reset" file and put only the output (if there where any data in the file, it will be lost)-- Secret_Doom - Leonardo Pignataro --
secret_doom@hotmail.com
www.batch.hpg.com.br

There are 3 ways to use text output from a
DOS program.1. Use the right arrow,>,to send the text to
a file. For example to save the contents
of a directory type, dir>dir.txt. This
redirects the output to the file you
choose,in this case dir.txt. Your
program then can read the file.2. Use the left arrow, <, to use a file such
as dir.txt from above to send file
contents to the input of your program. For
example type, dir.txt < yourprog. Then
yourprog code would read the file just as
if you typed the info yourself using the
normal keyboard input functions. Of course
you could also add code to open the file
and read it but this is a shortcut3. Use the pipe symbol, | , to use the output
of another program to input directly to
yours. Then your program can input the
text as if it came from the keyboard. In
C it would be getch() for 1 character at
a time or gets() to read an etire line.
Keep reading until you get a NULL. For
example type dir | yourprog. Then
yourprog code reads the directory listing
the same way you would as if you typed it
in yourself.

If you are saying that you have a DOS program that spits out some info - but offers no way to print or save to disk, then no. No way to save, except maybe print screen.
If it offers to print the data there was a program called PRN2FILE which would redirect anything going to the printer to a file on disk.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |