ex.hlp (Topic list)
LPOS Function Example
                        Example                Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
' This example uses the LPOS function is used to determine the position of
' the print head and avoid printing past the end of the line. Note: To run
' this program, you must have a printer connected to LPT1.
 
' To try this example:
' 1. Choose New Project from the File menu
' 2. Copy the code example below to the code window
' 3. Press F5 to run the example
 
 CLS                                     ' Clear the screen
 LPRINT "Team Members"; TAB(76); "TEAM"
 LPRINT
 INPUT "How many teams"; TEAMS
 INPUT "How many players per team"; PPT
 PRINT
 FOR T = 1 TO TEAMS
     INPUT "Team name: ", TEAM$
     FOR P = 1 TO PPT
          INPUT "   Enter player name: ", PLAYER$
          LPRINT PLAYER$;
          IF P < PPT THEN
               IF LPOS(0) > 55 THEN      ' Print a new line if print
                                         ' head past column 55
                    LPRINT : LPRINT "     ";
               ELSE
                    LPRINT ", ";         ' Otherwise, print a comma
               END IF
          END IF
     NEXT P
     LPRINT STRING$(80 - LPOS(0) - LEN(TEAM$), "."); TEAM$
 NEXT T