Pos
Returns the horizontal (left to right) position of the text cursor
Syntax
`
Declare Function Pos ( ) As Long
Declare Function Pos ( ByVal dummy As Long ) As Long
`
Usage
`
result = Pos[ ( dummy ) ]
`
Parameters
`dummy`
An unused parameter retained for backward compatibility with QBASIC.
Return Value
Returns the horizontal position of the text cursor.
Description
Returns the horizontal (left to right) position of the text cursor. The leftmost column is number `1`.
Example
`
Dim As Integer p
'' print starting column position
p = Pos()
Print "position: "; p
'' print a string, without a new-line
Print "ABCDEF";
'' print new column position:
p = Pos()
Print: Print "position: "; p
Print
''position changes after each Print:
Print "Column numbers: "
Print Pos(), Pos(), Pos(), Pos(), Pos()
`
Differences from QB

- The `dummy` parameter was not optional in QBASIC.

See also

- `CsrLin`
- `Tab`
- `Locate`