[fpc-pascal]WriteLn call in ncurses - help needed

Ken Wright kenw at cncware.com
Thu Feb 8 05:45:02 CET 2001


On Wed, 07 Feb 2001, you wrote:
> Hello :-)!
> 
> I'm porting a DOS application into Linux.
> This application use propriertary window library, particularily based on CRT and
> low-level DOS calls.
> I'm using ncrt.inc instead of CRT and low-level DOS calls.

Just to make sure. Are you including ncrt.inc in your program with
{$I}, or are you putting ncrt in your "uses" clause? You need to include the
unit so it initializes correctly.

> But I have a problem calling WriteLn from application part. 
> 
> A window is scrolled by placing cursor at the end of last line and calling
> WriteLn. This call cleans current line and scrolls window by one line.
> 
> Why is the current line being cleaned?  What ncurses window parameter must (or
> can) I set  to solve this problem?


The following test program works correctly for me the way you decribe. The
readkeys are just to pause so you can see the steps. If this doesn't work for
you, try downloading the latest ncrt from http://www.cncware.com/fpc.html just
to make sure you've got the latest.

program t;
uses ncrt;
begin
   gotoxy(1,25);write('testing');readkey;
   gotoxy(80,25);readkey;
   writeln;
end.

However, a note about writeln with ncrt. The ncurses library does do something
like you describe. It first clears the current line from the cursor to the right
margin before doing the line feed. So if you placed the cursor at column 1 
rather than column 80, it would behave like the problem you described. This is
part of ncurses and can't be changed.

Ken




More information about the fpc-pascal mailing list