Forum > Windows

Problems with getting Output of TProcess

(1/1)

cybermonkey342:
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: http://wiki.lazarus.freepascal.org/Executing_External_Programs). 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;
 
BEGIN
writeln ('Hello World');   
END.
--- 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)

eny:
Remove 'uses crt'

cybermonkey342:
Oh my! Thanks a lot that does the trick.

Leledumbo:
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).

Navigation

[0] Message Index

Go to full version