mirror of
https://github.com/QB64Official/qb64.git
synced 2024-08-31 05:20:17 +00:00
45 lines
1.6 KiB
Text
45 lines
1.6 KiB
Text
|
The {{KW|LPOS}} function returns the current LPT printer head position.
|
||
|
|
||
|
|
||
|
{{PageSyntax}}
|
||
|
:''result%'' = {{KW|LPOS}}({{Parameter|index%}})
|
||
|
|
||
|
|
||
|
{{PageDescription}}
|
||
|
* {{Parameter|index%}} is the index of the printer, which can have the following values:
|
||
|
** 0 - LPT1:
|
||
|
** 1 - LPT1:
|
||
|
** 2 - LPT2:
|
||
|
** 3 - LPT3:
|
||
|
* The LPOS function does not necessarily give the physical position of the print head because it does not expand tab characters. In addition, some printers may buffer characters.
|
||
|
|
||
|
|
||
|
{{PageExamples}}
|
||
|
:Prompts the user for team names and the names of players on each team. It then prints the players and their teams on the printer.
|
||
|
{{CodeStart}}{{Cl|CLS}}
|
||
|
{{Cl|LPRINT}} "Team Members"; {{Cl|TAB}}(76); "TEAM" : {{Cl|LPRINT}}
|
||
|
{{Cl|INPUT}} "How many teams"; TEAMS
|
||
|
{{Cl|INPUT}} "How many players per team";PPT
|
||
|
{{Cl|PRINT}}
|
||
|
{{Cl|FOR}} T = 1 TO TEAMS
|
||
|
{{Cl|INPUT}} "Team name: ", TEAM$
|
||
|
{{Cl|FOR}} P = 1 TO PPT
|
||
|
{{Cl|INPUT}} " Enter player name: ", PLAYER$
|
||
|
{{Cl|LPRINT}} PLAYER$;
|
||
|
{{Cl|IF...THEN|IF}} P < PPT {{Cl|THEN}}
|
||
|
{{Cl|IF...THEN|IF}} {{Cl|LPOS}}(0) > 55 {{Cl|THEN}} ' Print a new line if print head past column 55.
|
||
|
{{Cl|LPRINT}} : {{Cl|LPRINT}} {{Cl|SPACE$}}(5);
|
||
|
{{Cl|ELSE}}
|
||
|
{{Cl|LPRINT}} ", "; 'Otherwise, print a comma.
|
||
|
{{Cl|END}} IF
|
||
|
{{Cl|END}} IF
|
||
|
{{Cl|NEXT}} P
|
||
|
{{Cl|LPRINT}} {{Cl|STRING$}}(80 - {{Cl|LPOS}}(0) - {{Cl|LEN}}(TEAM$),"."); TEAM$
|
||
|
{{Cl|NEXT}} T
|
||
|
{{CodeEnd}}
|
||
|
|
||
|
|
||
|
{{PageSeeAlso}}
|
||
|
|
||
|
|
||
|
{{PageNavigation}}
|