slang-users mailing list

[2000 Date Index] [2000 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: getting SLang to print with "\n" newlines.


Larry <larrywyb@xxxxxxxxxxxx> wrote:
>   SLsmg_set_color(4);
>   fptr = fopen("list.txt","r");
>   while(fgets(string,80,fptr) != NULL)
>     {
>	
>	SLsmg_write_string(string);
>	SLsmg_refresh();
>     }		
>   getchar();

You should call SLsmg_refresh only when you want the screen to be
updated.  You can achieve what you want in two ways:

1.  
   
   SLsmg_Newline_Behavior = SLSMG_NEWLINE_MOVES;
   while(fgets(string,80,fptr) != NULL)
     SLsmg_write_string(string);
   SLsmg_refresh();
   getchar();

2. (preferred solution)
   
   int row = 0;
   while(fgets(string,80,fptr) != NULL)
     {
	SLsmg_gotoc (row, 0);
	SLsmg_write_string(string);
	row++;
     }
   SLsmg_refresh();
   getchar();

I encourage you to look at slang/demo/pager.c.

--John


[2000 date index] [2000 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]