csrlin - vertical coordinate of current cursor position


v = csrlin


Csrlin contains the current line (row) position of the cursor.  The uppermost line is identified as line 1.  To get the current column location of the cursor, use the pos function. 


The program
	lin = csrlin		'record current line
	col = pos(0)		'record current column
	locate 12, 36		'center the cursor
	print "Basmark"
	locate lin, col		'restore position
saves the current vertical position of the cursor in the variable lin and the current horizontal position of the cursor in the variable col.  It then moves the cursor to line 12, column 36, and prints the string "Basmark" there.  Finally, it moves the cursor back to the saved position as specified by the values of lin and col. 


locate, pos


Since most terminals do not provide a way of reading the actual position of the cursor on the screen, the cursor position is maintained in software at run-time.  Therefore, local cursor motions will not be correctly handled and will cause csrlin to give incorrect results. 

The vertical cursor position is, of course, dependent on the number of rows on the userís screen.  This is determined by examining the environment variable TERM and looking up the terminal in the systemís terminal capability database, either /etc/termcap or /usr/lib/terminfo.  If the terminal type cannot be determined or the terminal capability database can not be accessed, the number of rows is assumed to be 24. 

from The Basmark QuickBASIC Programmerís Manual by Lawrence Leinweber