go to previous page   go to home page   go to next page

Answer:

Yes.


File Redirection

But, soft! what light through yonder window breaks? and so on

From the command line, you can ask the the bytes in the standard input stream come from a disk file as follows. This works with any file that is using standard IO to read from the standard input stream. The executable file fileToCaps.exe and the input file someFile.txt should be in the default subdirectory of the command prompt window, although you can use full or relative pathnames to the files if you want. The program has done nothing extra and nothing extra needs to be done to the file.

E:>fileToCaps < someFile.txt

To ask that the output stream be sent to a disk file rather than to the monitor, do this:

E:>fileToCaps > someFile.txt

This will replace someFile.txt, so be careful. You can combine these in one command. In the above screen shot, an existing text file balconyScene.txt is used as input and an all-caps version balconyCaps.txt is created.

E:>fileToCaps < balconyScene.txt > balconyCaps.txt

The command line command TYPE merely echoes the file to the monitor. Similar commands (and file redirection) are available in Unix and Linux.


QUESTION 12:

How do you concatenate the output of the program onto an existing file?