Forum > Windows

Problems with getting Output of TProcess


I have a problem with TProcess in Windows which works fine in Linux, though. I have a Pascal program which "writelns" to the console, of course compiled with $apptype console. The output works fine. Then I have another program which should read the output. This does not work. (I use the third example as a reading program of: This works fine on Linux. Of course it works fine on Windows except for reading the output of Pascal programs.
So this C program works:

--- Code: ---#include <stdio.h>
int main(int argc, char** argv)
   printf ("Hello World\n");
   return 0;
--- End code ---
Output is: Hello World.

This does not work:

--- Code: ---{$apptype console}
program Helloworld;
uses crt;
writeln ('Hello World');   
--- End code ---

No output at all is recognized. (But if I start this program solely "Hello World" is written to the console ...)
So what can I do? I don't want to re-implement my program in C. ("Hello World" is just an example)

Remove 'uses crt'

Oh my! Thanks a lot that does the trick.

Please stop writing Pascal based console programs using Crt unit. It overrides the video driver and messes up the default buffering system. Most of the time you don't need any of it's functionality and even if you do, they can be replaced with KVM units (keyboard, Video, Mouse).


[0] Message Index

Go to full version