[fpc-pascal]CR / CRLF problem when redirecting to file
Jonas Maebe
jonas at zeus.ugent.be
Sun Sep 14 20:10:20 CEST 2003
On zondag, sep 14, 2003, at 19:42 Europe/Brussels, John Coppens wrote:
> Is there no elegant solution to this? I use a library of mine that does
> some screen operations, like gotoxy, and includes the CRT library. So,
> even if I only use hex output from that library, I still get CRT for
> free.
> I could seperate those routines, but that CRT library would always
> dangle
> there as a Damocles's sword...
No, the problem is that the CRT unit has to change the settings of
console to be able to do everything you expect from it. You can do this:
uses
crt;
var
t: text;
begin
assign(t,'');
rewrite(t);
writeln(t,'This goes to stdout without passing through the crt unit');
end.
but the console is still in raw mode then and you will still get
mangled output in some cases (or maybe get wrong output on screen
instead of on disk). Maybe using ncrt instead of crt may help, I don't
know.
> I'm no expert - doesn't the forms library do something similar as the
> crt
> library?
I don't know the forms unit, I've never worked with it.
Jonas
More information about the fpc-pascal
mailing list