Terminal control/Positional read: Difference between revisions

From Rosetta Code
Content added Content deleted
m (→‎{{header|REXX}}: delerted previous entry, re-added language.)
m (whitespace/cleanup)
Line 6: Line 6:


=== {{header|ZX Spectrum Basic}} ===
=== {{header|ZX Spectrum Basic}} ===

<lang basic> 10 REM The top left corner is at position 0,0
<lang basic> 10 REM The top left corner is at position 0,0
20 REM So we subtract one from the coordinates
20 REM So we subtract one from the coordinates
Line 12: Line 11:


=={{header|REXX}}==
=={{header|REXX}}==
The REXX doesn't have any cursor or screen management tools, but some REXX interpreters have
The REXX doesn't have any cursor or screen management tools, but some REXX interpreters have added the functionality via different methods.
<br>added the functionality via different methods.
<br><br>Below is one example PC/REXX has implemented:
<lang rexx>
/*REXX program demonstrates reading a char at specific screen location.*/


/*──────────────────────────────────────────────────────────────────────*/
/*─────────────────────examples are for PC/REXX only.───────────────────*/
/*──────────────────────────────────────────────────────────────────────*/


{{works with|PC/REXX}}
<lang rexx>/*REXX program demonstrates reading a char at specific screen location.*/


row=20 /*point to row twenty. */
row=20 /*point to row twenty. */
Line 30: Line 22:
stuff=scrread(row,col,howMany) /*this'll do it. */
stuff=scrread(row,col,howMany) /*this'll do it. */


other=scrRead(40,55,2) /*same thing, but for row forty. */</lang>

other=scrRead(40,55,2) /*same thing, but for row forty. */
</lang>

Revision as of 13:40, 17 December 2010

Terminal control/Positional read is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

Determine the character displayed on the screen at column 3, row 6 and store that character in a variable.

BASIC

ZX Spectrum Basic

<lang basic> 10 REM The top left corner is at position 0,0

20 REM So we subtract one from the coordinates
30 LET c$ = SCREEN$(5,2)</lang>

REXX

The REXX doesn't have any cursor or screen management tools, but some REXX interpreters have added the functionality via different methods.

Works with: PC/REXX

<lang rexx>/*REXX program demonstrates reading a char at specific screen location.*/

row=20 /*point to row twenty. */ col=55 /*point co column fifty-five. */ howMany=3 /*read a trio of characters. */

stuff=scrread(row,col,howMany) /*this'll do it. */

other=scrRead(40,55,2) /*same thing, but for row forty. */</lang>