hello.pas:
Program hello;
Begin
writeln('hello world');
End.
or C program:
#include <stdio.h>
main()
{
printf("hello world\n");
return 0;
}
When run, this program sends hello world to the screen. By making a DOS EXE file (see the particular compiler for exact syntax), you can then shell (or go to DOS), and run program by typing hello (remember type EXIT from the DOS prompt to return to your compiler session).
Now for the re-direction, you can send the output to a file called myoutput.fil by giving the DOS command:
hello > myoutput.filmyoutput.fil
You can have your program read from a file by using the < character. The syntax is:
program_name < file_name