Returns the position of the cursor.
// Find current row and column // position of the cursor r = csrlin(); c = csrcol(); // Clear the command window cls; /* ** Re-position the cursor to its location before the program ** input/output window was cleared */ locate r,c;
In this example the screen is cleared without affecting the cursor position.
p will contain the current column or row position of the cursor on the screen. The upper left corner is (1,1).
csrcol() returns the column position of the cursor.
csrlin() returns the row
The locate commmand allows the cursor to be positioned at a specific row and column.
csrcol() returns the cursor column with respect to the current output
line, i.e., it will return the same value whether the text is wrapped or
csrlin() returns the cursor line with respect to the top line in the