Forum > General

TextColor and StdOut

(1/1)

Matze:
Hello,
why does this dont work?

assign(FO, '');
rewrite(FO);
TextColor(Red);
write(FO,'some Text');

The TextColor is not set to red.
Can you help?
Thanks.

jamie:
That looks like you need to use the CRT unit to start with.

Also, remove the Assign and Rewrite.

If you are trying to do terminal output, then you need to use Ansi Escape codes or whatever the terminal understands.

Jonas Maebe:
You have to use assigncrt instead of assign if you want to use the functionality of the crt unit with it.

Thaddy:
Something like so:
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---uses Crt;var  FO : Text;begin  AssignCrt(FO);  Rewrite(FO);   TextBackground(white);  ClrEol;  TextColor(Red);  WriteLn(FO,'Some text');  Close(FO);end.
Taken and adapted from the example in the manual for Assigncrt:
https://www.freepascal.org/docs-html/rtl/crt/assigncrt.html

Navigation

[0] Message Index

Go to full version