: : : : Hi, let me explain what I am trying to do and how you may be able to help.
: : : : I am writing a windows shell (in VB due to the fact that it is the only language I know) to run some old Turbo Pascal programs. I have created a shell that works fine with basic windows commands such as dir, ping, ipconfig etc, but when I run these TP programs I cannot capture the text sent to the screen.
: : : : The author (an old friend) doesn't have the time to transfer them to Delphi, but may well be prepared to modify the original source code to meet my needs if it is very simple or alternatively allow me to do so. As I know nothing about Pascal, I was wondering if someone could explain the different ways Pascal writes to the screen, and which ways are possible to capture via redirection to a file, for example, by adding ">output.txt" to the end of the command line.
: : : : Thanks in advance.
: : : :
: : : DOS shell pascal programs write to the screen as any other shell aplications. They use Write() and WriteLn() procedures. Rederection is posible as you wrote through the ">" character in the shell or you can code the program to write every output to a file. It is not difficult:) Just ask us for guidence, or post some sample code, and we will show you how it is done.
: : :
: : Thanks for replying, but I think I obviously didn't explain the problem very clearly. I have a Compiled Turbo Pascal DOS application which writes to the screen, but I cannot redirect it using the ">" character, or with the Command Line Shell I have created in VB, as I can with most other programs . This is why I was wondering whether there was a form of writing to the screen without it going via the STDOUT as this seems to be what is happening. I have read that it is possible to to show text as a graphics, defining the co-ord on the screen, but I doubt this is what the program is doing as it always places the text on the following line in a DOS window. I am basically trying to work out what the programmer has done, to know whether it is easy for me/or him to change the code. The autor will be back in country next week and I wanted to at least have an idea about how he was doing everything and hence be able to have some solutions prepared.
: I tried redirectin my free pascal program to a txt file using ">" but it didn't work. That gives you only one more option; rewriting the code. This shouldn't be so hard as you already know VB. A language is a language, just the sintax changes. What you need to do is change all the Write(x) and WriteLn(x) commands to Write(file, x) and WriteLn(file, x).
: program sample;
: const s='sample text';
: var f:text;
: We can help you with the code if you encounter any problems.
Cheers for all your help.