Terminal control/Cursor positioning: Difference between revisions
m (→{{header|Phix}}: syntax coloured, marked p2js incompatible) |
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
||
Line 8: | Line 8: | ||
=={{header|AArch64 Assembly}}== |
=={{header|AArch64 Assembly}}== |
||
{{works with|as|Raspberry Pi 3B version Buster 64 bits}} |
{{works with|as|Raspberry Pi 3B version Buster 64 bits}} |
||
<syntaxhighlight lang="aarch64 assembly"> |
|||
<lang AArch64 Assembly> |
|||
/* ARM assembly AARCH64 Raspberry PI 3B */ |
/* ARM assembly AARCH64 Raspberry PI 3B */ |
||
/* program cursorPos64.s */ |
/* program cursorPos64.s */ |
||
Line 64: | Line 64: | ||
/* for this file see task include a file in language AArch64 assembly */ |
/* for this file see task include a file in language AArch64 assembly */ |
||
.include "../includeARM64.inc" |
.include "../includeARM64.inc" |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|Action!}}== |
=={{header|Action!}}== |
||
< |
<syntaxhighlight lang="action!">PROC Main() |
||
Position(3,6) |
Position(3,6) |
||
Print("Hello") |
Print("Hello") |
||
RETURN</ |
RETURN</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Cursor_positioning.png Screenshot from Atari 8-bit computer] |
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Cursor_positioning.png Screenshot from Atari 8-bit computer] |
||
Line 75: | Line 75: | ||
=={{header|Ada}}== |
=={{header|Ada}}== |
||
< |
<syntaxhighlight lang="ada">with Ada.Text_IO; |
||
procedure Cursor_Pos is |
procedure Cursor_Pos is |
||
Line 83: | Line 83: | ||
Ada.Text_IO.Set_Col(3); |
Ada.Text_IO.Set_Col(3); |
||
Ada.Text_IO.Put("Hello"); |
Ada.Text_IO.Put("Hello"); |
||
end Cursor_Pos;</ |
end Cursor_Pos;</syntaxhighlight> |
||
=={{header|ARM Assembly}}== |
=={{header|ARM Assembly}}== |
||
{{works with|as|Raspberry Pi}} |
{{works with|as|Raspberry Pi}} |
||
<syntaxhighlight lang="arm assembly"> |
|||
<lang ARM Assembly> |
|||
/* ARM assembly Raspberry PI */ |
/* ARM assembly Raspberry PI */ |
||
Line 155: | Line 155: | ||
bx lr @ return |
bx lr @ return |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|Arturo}}== |
=={{header|Arturo}}== |
||
< |
<syntaxhighlight lang="rebol">goto 3 6 |
||
print "Hello"</ |
print "Hello"</syntaxhighlight> |
||
=={{header|AutoHotkey}}== |
=={{header|AutoHotkey}}== |
||
{{works with|AutoHotkey_L}} |
{{works with|AutoHotkey_L}} |
||
Remember that AHK is not built for the console, so we must call the WinAPI directly. |
Remember that AHK is not built for the console, so we must call the WinAPI directly. |
||
< |
<syntaxhighlight lang="ahk">DllCall( "AllocConsole" ) ; create a console if not launched from one |
||
hConsole := DllCall( "GetStdHandle", int, STDOUT := -11 ) |
hConsole := DllCall( "GetStdHandle", int, STDOUT := -11 ) |
||
Line 179: | Line 179: | ||
return out |
return out |
||
return 0 |
return 0 |
||
}</ |
}</syntaxhighlight> |
||
=={{header|Axe}}== |
=={{header|Axe}}== |
||
Since the rows and columns are zero-indexed, we must subtract 1 from both. |
Since the rows and columns are zero-indexed, we must subtract 1 from both. |
||
< |
<syntaxhighlight lang="axe">Output(2,5,"HELLO")</syntaxhighlight> |
||
=={{header|BaCon}}== |
=={{header|BaCon}}== |
||
< |
<syntaxhighlight lang="freebasic">' Cursor positioning, requires ANSI compliant terminal |
||
GOTOXY 3,6 |
GOTOXY 3,6 |
||
PRINT "Hello"</ |
PRINT "Hello"</syntaxhighlight> |
||
The X Y in <code>GOTOXY</code> is Column Row order. |
The X Y in <code>GOTOXY</code> is Column Row order. |
||
Line 194: | Line 194: | ||
==={{header|Applesoft BASIC}}=== |
==={{header|Applesoft BASIC}}=== |
||
< |
<syntaxhighlight lang="applesoft basic"> 10 VTAB 6: HTAB 3 |
||
20 PRINT "HELLO"</ |
20 PRINT "HELLO"</syntaxhighlight> |
||
==={{header|IS-BASIC}}=== |
==={{header|IS-BASIC}}=== |
||
< |
<syntaxhighlight lang="is-basic">100 PRINT AT 6,3:"Hello"</syntaxhighlight> |
||
==={{header|Locomotive Basic}}=== |
==={{header|Locomotive Basic}}=== |
||
< |
<syntaxhighlight lang="locobasic"> 10 LOCATE 3,6 |
||
20 PRINT "Hello"</ |
20 PRINT "Hello"</syntaxhighlight> |
||
==={{header|ZX Spectrum Basic}}=== |
==={{header|ZX Spectrum Basic}}=== |
||
< |
<syntaxhighlight lang="zxbasic"> 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 |
||
30 PRINT AT 5,2 "Hello"</ |
30 PRINT AT 5,2 "Hello"</syntaxhighlight> |
||
==={{header|BBC BASIC}}=== |
==={{header|BBC BASIC}}=== |
||
< |
<syntaxhighlight lang="bbcbasic">PRINT TAB(2,5);"Hello"</syntaxhighlight> |
||
==={{header|Commodore BASIC}}=== |
==={{header|Commodore BASIC}}=== |
||
< |
<syntaxhighlight lang="basic"> 100 print chr$(19) :rem change to lowercase set |
||
110 print chr$(14) :rem go to position 1,1 |
110 print chr$(14) :rem go to position 1,1 |
||
120 print:print:print:print |
120 print:print:print:print |
||
130 print tab(2) "Hello" </ |
130 print tab(2) "Hello" </syntaxhighlight> |
||
=={{header|Befunge}}== |
=={{header|Befunge}}== |
||
Assuming a terminal with support for ANSI escape sequences. |
Assuming a terminal with support for ANSI escape sequences. |
||
< |
<syntaxhighlight lang="befunge">0"olleHH3;6["39*>:#,_$@</syntaxhighlight> |
||
=={{header|Blast}}== |
=={{header|Blast}}== |
||
< |
<syntaxhighlight lang="blast"># This will display a message at a specific position on the terminal screen |
||
.begin |
.begin |
||
cursor 6,3 |
cursor 6,3 |
||
display "Hello!" |
display "Hello!" |
||
return |
return |
||
# This is the end of the script</ |
# This is the end of the script</syntaxhighlight> |
||
=={{header|C}}/{{header|C++}}== |
=={{header|C}}/{{header|C++}}== |
||
Using ANSI escape sequence, where ESC[y;xH moves curser to row y, col x:< |
Using ANSI escape sequence, where ESC[y;xH moves curser to row y, col x:<syntaxhighlight lang="c">#include <stdio.h> |
||
int main() |
int main() |
||
{ |
{ |
||
printf("\033[6;3HHello\n"); |
printf("\033[6;3HHello\n"); |
||
return 0; |
return 0; |
||
}</ |
}</syntaxhighlight> |
||
The C version of the minesweeper game uses curses. |
The C version of the minesweeper game uses curses. |
||
Line 242: | Line 242: | ||
On Windows, using console API: |
On Windows, using console API: |
||
< |
<syntaxhighlight lang="c">#include <windows.h> |
||
int main() { |
int main() { |
||
Line 250: | Line 250: | ||
WriteConsole(hConsole, "Hello", 5, NULL, NULL); |
WriteConsole(hConsole, "Hello", 5, NULL, NULL); |
||
return 0; |
return 0; |
||
}</ |
}</syntaxhighlight> |
||
=={{header|C sharp|C#}}== |
=={{header|C sharp|C#}}== |
||
{{works with|Mono|1.2}} |
{{works with|Mono|1.2}} |
||
{{works with|Visual C sharp|Visual C#|2003}} |
{{works with|Visual C sharp|Visual C#|2003}} |
||
< |
<syntaxhighlight lang="csharp">static void Main(string[] args) |
||
{ |
{ |
||
Console.SetCursorPosition(3, 6); |
Console.SetCursorPosition(3, 6); |
||
Console.Write("Hello"); |
Console.Write("Hello"); |
||
}</ |
}</syntaxhighlight> |
||
=={{header|COBOL}}== |
=={{header|COBOL}}== |
||
< |
<syntaxhighlight lang="cobol"> IDENTIFICATION DIVISION. |
||
PROGRAM-ID. cursor-positioning. |
PROGRAM-ID. cursor-positioning. |
||
Line 269: | Line 269: | ||
GOBACK |
GOBACK |
||
.</ |
.</syntaxhighlight> |
||
=={{header|Common Lisp}}== |
=={{header|Common Lisp}}== |
||
==={{header|ncurses}}=== |
==={{header|ncurses}}=== |
||
To interface the ncurses C library from Lisp, the ''croatoan'' library is used. |
To interface the ncurses C library from Lisp, the ''croatoan'' library is used. |
||
< |
<syntaxhighlight lang="lisp">(defun cursor-positioning () |
||
(with-screen (scr :input-blocking t :input-echoing nil :cursor-visible nil) |
(with-screen (scr :input-blocking t :input-echoing nil :cursor-visible nil) |
||
(move scr 5 2) |
(move scr 5 2) |
||
Line 280: | Line 280: | ||
(refresh scr) |
(refresh scr) |
||
;; wait for keypress |
;; wait for keypress |
||
(get-char scr)))</ |
(get-char scr)))</syntaxhighlight> |
||
=={{header|D}}== |
=={{header|D}}== |
||
Line 291: | Line 291: | ||
puts the cursor at line L and column C. |
puts the cursor at line L and column C. |
||
<syntaxhighlight lang="d"> |
|||
<lang D> |
|||
import std.stdio; |
import std.stdio; |
||
Line 298: | Line 298: | ||
writef("\033[6;3fHello"); |
writef("\033[6;3fHello"); |
||
} |
} |
||
</syntaxhighlight> |
|||
</lang> |
|||
'''Output:''' |
'''Output:''' |
||
Line 314: | Line 314: | ||
=={{header|Elena}}== |
=={{header|Elena}}== |
||
ELENA 4.x : |
ELENA 4.x : |
||
< |
<syntaxhighlight lang="elena">public program() |
||
{ |
{ |
||
console.setCursorPosition(3,6).write("Hello") |
console.setCursorPosition(3,6).write("Hello") |
||
}</ |
}</syntaxhighlight> |
||
=={{header|Euphoria}}== |
=={{header|Euphoria}}== |
||
< |
<syntaxhighlight lang="euphoria">position(6,3) |
||
puts(1,"Hello")</ |
puts(1,"Hello")</syntaxhighlight> |
||
=={{header|F_Sharp|F#}}== |
=={{header|F_Sharp|F#}}== |
||
< |
<syntaxhighlight lang="fsharp">open System |
||
Console.SetCursorPosition(3, 6) |
Console.SetCursorPosition(3, 6) |
||
Console.Write("Hello")</ |
Console.Write("Hello")</syntaxhighlight> |
||
=={{header|Forth}}== |
=={{header|Forth}}== |
||
< |
<syntaxhighlight lang="forth">2 5 at-xy ." Hello"</syntaxhighlight> |
||
=={{header|Fortran}}== |
=={{header|Fortran}}== |
||
===Intel Fortran on Windows=== |
===Intel Fortran on Windows=== |
||
< |
<syntaxhighlight lang="fortran">program textposition |
||
use kernel32 |
use kernel32 |
||
implicit none |
implicit none |
||
Line 343: | Line 343: | ||
q = SetConsoleCursorPosition(hConsole, T_COORD(3, 6)) |
q = SetConsoleCursorPosition(hConsole, T_COORD(3, 6)) |
||
q = WriteConsole(hConsole, loc("Hello"), 5, NULL, NULL) |
q = WriteConsole(hConsole, loc("Hello"), 5, NULL, NULL) |
||
end program</ |
end program</syntaxhighlight> |
||
=={{header|FreeBASIC}}== |
=={{header|FreeBASIC}}== |
||
< |
<syntaxhighlight lang="freebasic">Locate 6, 3 : Print "Hello" |
||
Sleep</ |
Sleep</syntaxhighlight> |
||
=={{header|Go}}== |
=={{header|Go}}== |
||
===External command=== |
===External command=== |
||
< |
<syntaxhighlight lang="go">package main |
||
import ( |
import ( |
||
Line 368: | Line 368: | ||
cmd.Run() |
cmd.Run() |
||
fmt.Println("Hello") |
fmt.Println("Hello") |
||
}</ |
}</syntaxhighlight> |
||
===ANSI escape codes=== |
===ANSI escape codes=== |
||
< |
<syntaxhighlight lang="go">package main |
||
import "fmt" |
import "fmt" |
||
Line 376: | Line 376: | ||
func main() { |
func main() { |
||
fmt.Println("\033[2J\033[6;3HHello") |
fmt.Println("\033[2J\033[6;3HHello") |
||
}</ |
}</syntaxhighlight> |
||
===Ncurses=== |
===Ncurses=== |
||
{{libheader|curses}} |
{{libheader|curses}} |
||
< |
<syntaxhighlight lang="go">package main |
||
import ( |
import ( |
||
Line 396: | Line 396: | ||
s.Println("Hello") |
s.Println("Hello") |
||
s.GetChar() |
s.GetChar() |
||
}</ |
}</syntaxhighlight> |
||
=={{header|Icon}} and {{header|Unicon}}== |
=={{header|Icon}} and {{header|Unicon}}== |
||
If the OS has older termcap files, CUP is included with <tt>link ansi</tt> |
If the OS has older termcap files, CUP is included with <tt>link ansi</tt> |
||
< |
<syntaxhighlight lang="unicon">procedure main() |
||
writes(CUP(6,3), "Hello") |
writes(CUP(6,3), "Hello") |
||
end |
end |
||
Line 407: | Line 407: | ||
writes("\^[[",i,";",j,"H") |
writes("\^[[",i,";",j,"H") |
||
return |
return |
||
end</ |
end</syntaxhighlight> |
||
=={{header|J}}== |
=={{header|J}}== |
||
Using terminal positioning verbs of [[Terminal_control/Coloured_text#J]] |
Using terminal positioning verbs of [[Terminal_control/Coloured_text#J]] |
||
<lang |
<syntaxhighlight lang="j">'Hello',~move 6 3</syntaxhighlight> |
||
=={{header|Julia}}== |
=={{header|Julia}}== |
||
< |
<syntaxhighlight lang="julia">const ESC = "\u001B" |
||
gotoANSI(x, y) = print("$ESC[$(y);$(x)H") |
gotoANSI(x, y) = print("$ESC[$(y);$(x)H") |
||
Line 420: | Line 420: | ||
gotoANSI(3, 6) |
gotoANSI(3, 6) |
||
println("Hello") |
println("Hello") |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|Kotlin}}== |
=={{header|Kotlin}}== |
||
{{Works with|Ubuntu|14.04}} |
{{Works with|Ubuntu|14.04}} |
||
< |
<syntaxhighlight lang="scala">// version 1.1.2 |
||
fun main(args: Array<String>) { |
fun main(args: Array<String>) { |
||
print("\u001Bc") // clear screen first |
print("\u001Bc") // clear screen first |
||
println("\u001B[6;3HHello") |
println("\u001B[6;3HHello") |
||
}</ |
}</syntaxhighlight> |
||
=={{header|Lasso}}== |
=={{header|Lasso}}== |
||
< |
<syntaxhighlight lang="lasso">local(esc = decode_base64('Gw==')) |
||
stdout( #esc + '[6;3HHello')</ |
stdout( #esc + '[6;3HHello')</syntaxhighlight> |
||
=={{header|Liberty BASIC}}== |
=={{header|Liberty BASIC}}== |
||
< |
<syntaxhighlight lang="lb">locate 3, 6 |
||
print "Hello" |
print "Hello" |
||
</ |
</syntaxhighlight> |
||
=={{header|Logo}}== |
=={{header|Logo}}== |
||
< |
<syntaxhighlight lang="logo">setcursor [2 5] |
||
type "Hello</ |
type "Hello</syntaxhighlight> |
||
You can also draw positioned text on the turtle graphics window. |
You can also draw positioned text on the turtle graphics window. |
||
< |
<syntaxhighlight lang="logo">setpos [20 50] |
||
setxy 20 30 ; alternate way to set position |
setxy 20 30 ; alternate way to set position |
||
label "Hello</ |
label "Hello</syntaxhighlight> |
||
=={{header|Mathematica}}/{{header|Wolfram Language}}== |
=={{header|Mathematica}}/{{header|Wolfram Language}}== |
||
< |
<syntaxhighlight lang="mathematica">Run["tput cup 6 3"] |
||
Print["Hello"]</ |
Print["Hello"]</syntaxhighlight> |
||
=={{header|Nim}}== |
=={{header|Nim}}== |
||
< |
<syntaxhighlight lang="nim">import terminal |
||
setCursorPos(3, 6) |
setCursorPos(3, 6) |
||
echo "Hello"</ |
echo "Hello"</syntaxhighlight> |
||
=={{header|NS-HUBASIC}}== |
=={{header|NS-HUBASIC}}== |
||
< |
<syntaxhighlight lang="ns-hubasic">10 LOCATE 3,6 |
||
20 PRINT "HELLO"</ |
20 PRINT "HELLO"</syntaxhighlight> |
||
=={{header|OCaml}}== |
=={{header|OCaml}}== |
||
Line 466: | Line 466: | ||
Using the library [http://forge.ocamlcore.org/projects/ansiterminal/ ANSITerminal]: |
Using the library [http://forge.ocamlcore.org/projects/ansiterminal/ ANSITerminal]: |
||
< |
<syntaxhighlight lang="ocaml">#load "unix.cma" |
||
#directory "+ANSITerminal" |
#directory "+ANSITerminal" |
||
#load "ANSITerminal.cma" |
#load "ANSITerminal.cma" |
||
Line 476: | Line 476: | ||
Trm.set_cursor 3 6; |
Trm.set_cursor 3 6; |
||
Trm.print_string [] "Hello"; |
Trm.print_string [] "Hello"; |
||
;;</ |
;;</syntaxhighlight> |
||
=={{header|Pascal}}== |
=={{header|Pascal}}== |
||
<syntaxhighlight lang="pascal"> |
|||
<lang Pascal> |
|||
program cursor_pos; |
program cursor_pos; |
||
uses crt; |
uses crt; |
||
Line 486: | Line 486: | ||
write('Hello'); |
write('Hello'); |
||
end. |
end. |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|Perl}}== |
=={{header|Perl}}== |
||
Using the Term::Cap module: |
Using the Term::Cap module: |
||
< |
<syntaxhighlight lang="perl"> |
||
use Term::Cap; |
use Term::Cap; |
||
Line 496: | Line 496: | ||
print $t->Tgoto("cm", 2, 5); # 0-based |
print $t->Tgoto("cm", 2, 5); # 0-based |
||
print "Hello"; |
print "Hello"; |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|Phix}}== |
=={{header|Phix}}== |
||
<!--< |
<!--<syntaxhighlight lang="phix">(notonline)--> |
||
<span style="color: #008080;">without</span> <span style="color: #008080;">js</span> <span style="color: #000080;font-style:italic;">-- position</span> |
<span style="color: #008080;">without</span> <span style="color: #008080;">js</span> <span style="color: #000080;font-style:italic;">-- position</span> |
||
<span style="color: #7060A8;">position</span><span style="color: #0000FF;">(</span><span style="color: #000000;">6</span><span style="color: #0000FF;">,</span><span style="color: #000000;">3</span><span style="color: #0000FF;">)</span> |
<span style="color: #7060A8;">position</span><span style="color: #0000FF;">(</span><span style="color: #000000;">6</span><span style="color: #0000FF;">,</span><span style="color: #000000;">3</span><span style="color: #0000FF;">)</span> |
||
<span style="color: #7060A8;">puts</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Hello"</span><span style="color: #0000FF;">)</span> |
<span style="color: #7060A8;">puts</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Hello"</span><span style="color: #0000FF;">)</span> |
||
<!--</ |
<!--</syntaxhighlight>--> |
||
=={{header|PHP}}== |
=={{header|PHP}}== |
||
<syntaxhighlight lang="php"> |
|||
<lang PHP> |
|||
echo "\033[".$x.",".$y."H"; // Position line $y and column $x. |
echo "\033[".$x.",".$y."H"; // Position line $y and column $x. |
||
echo "\033[".$n."A"; // Up $n lines. |
echo "\033[".$n."A"; // Up $n lines. |
||
Line 513: | Line 513: | ||
echo "\033[".$n."D"; // Backward $n columns. |
echo "\033[".$n."D"; // Backward $n columns. |
||
echo "\033[2J"; // Clear the screen, move to (0,0). |
echo "\033[2J"; // Clear the screen, move to (0,0). |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|PicoLisp}}== |
=={{header|PicoLisp}}== |
||
< |
<syntaxhighlight lang="picolisp">(call 'tput "cup" 6 3) |
||
(prin "Hello")</ |
(prin "Hello")</syntaxhighlight> |
||
=={{header|PowerShell}}== |
=={{header|PowerShell}}== |
||
The following will only work in the PowerShell console host. Most notably it will not work in the PowerShell ISE. |
The following will only work in the PowerShell console host. Most notably it will not work in the PowerShell ISE. |
||
< |
<syntaxhighlight lang="powershell">$Host.UI.RawUI.CursorPosition = New-Object System.Management.Automation.Host.Coordinates 2,5 |
||
$Host.UI.Write('Hello')</ |
$Host.UI.Write('Hello')</syntaxhighlight> |
||
Alternatively, in any PowerShell host that uses the Windows console, one can directly use the .NET <code>Console</code> class: |
Alternatively, in any PowerShell host that uses the Windows console, one can directly use the .NET <code>Console</code> class: |
||
< |
<syntaxhighlight lang="powershell">[Console]::SetCursorPosition(2,5) |
||
[Console]::Write('Hello')</ |
[Console]::Write('Hello')</syntaxhighlight> |
||
=={{header|PureBasic}}== |
=={{header|PureBasic}}== |
||
< |
<syntaxhighlight lang="purebasic">EnableGraphicalConsole(#True) |
||
ConsoleLocate(3,6) |
ConsoleLocate(3,6) |
||
Print("Hello")</ |
Print("Hello")</syntaxhighlight> |
||
=={{header|Python}}== |
=={{header|Python}}== |
||
Using ANSI escape sequence, where ESC[y;xH moves curser to row y, col x:< |
Using ANSI escape sequence, where ESC[y;xH moves curser to row y, col x:<syntaxhighlight lang="python">print("\033[6;3HHello")</syntaxhighlight> |
||
On Windows it needs to import and init the [http://code.google.com/p/colorama/ colorama] module first. |
On Windows it needs to import and init the [http://code.google.com/p/colorama/ colorama] module first. |
||
ANSI sequences are not recognized in Windows console, here is a program using Windows API: |
ANSI sequences are not recognized in Windows console, here is a program using Windows API: |
||
< |
<syntaxhighlight lang="python">from ctypes import * |
||
STD_OUTPUT_HANDLE = -11 |
STD_OUTPUT_HANDLE = -11 |
||
Line 554: | Line 554: | ||
windll.kernel32.WriteConsoleA(h, c_char_p(c), len(c), None, None) |
windll.kernel32.WriteConsoleA(h, c_char_p(c), len(c), None, None) |
||
print_at(6, 3, "Hello")</ |
print_at(6, 3, "Hello")</syntaxhighlight> |
||
=={{header|Quackery}}== |
=={{header|Quackery}}== |
||
< |
<syntaxhighlight lang="quackery"> [ number$ swap number$ |
||
$ 'print("\033[' rot join |
$ 'print("\033[' rot join |
||
char ; join |
char ; join |
||
Line 565: | Line 565: | ||
python ] is cursor-at ( x y --> ) |
python ] is cursor-at ( x y --> ) |
||
3 6 cursor-at say "Hello"</ |
3 6 cursor-at say "Hello"</syntaxhighlight> |
||
=={{header|Racket}}== |
=={{header|Racket}}== |
||
< |
<syntaxhighlight lang="racket"> |
||
#lang racket |
#lang racket |
||
(require (planet neil/charterm:3:0)) |
(require (planet neil/charterm:3:0)) |
||
Line 575: | Line 575: | ||
(charterm-cursor 3 6) |
(charterm-cursor 3 6) |
||
(displayln "Hello World")) |
(displayln "Hello World")) |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|Raku}}== |
=={{header|Raku}}== |
||
(formerly Perl 6) |
(formerly Perl 6) |
||
Assuming an ANSI terminal: |
Assuming an ANSI terminal: |
||
<lang |
<syntaxhighlight lang="raku" line>print "\e[6;3H"; |
||
print 'Hello';</ |
print 'Hello';</syntaxhighlight> |
||
=={{header|Retro}}== |
=={{header|Retro}}== |
||
< |
<syntaxhighlight lang="retro">with console' |
||
: hello 3 6 at-xy "Hello" puts ;</ |
: hello 3 6 at-xy "Hello" puts ;</syntaxhighlight> |
||
=={{header|REXX}}== |
=={{header|REXX}}== |
||
Line 591: | Line 591: | ||
<br>added the functionality via different methods (such as functions and/or subroutines). |
<br>added the functionality via different methods (such as functions and/or subroutines). |
||
{{works with|PC/REXX, Personal REXX}} |
{{works with|PC/REXX, Personal REXX}} |
||
< |
<syntaxhighlight lang="rexx">/*REXX program demonstrates moving the cursor position and writing of text to same place*/ |
||
call cursor 3,6 /*move the cursor to row 3, column 6. */ |
call cursor 3,6 /*move the cursor to row 3, column 6. */ |
||
Line 601: | Line 601: | ||
call scrwrite 40,60,'Hello.',,,14 /*another method ... in yellow. */ |
call scrwrite 40,60,'Hello.',,,14 /*another method ... in yellow. */ |
||
exit 0 /*stick a fork in it, we're all done. */</ |
exit 0 /*stick a fork in it, we're all done. */</syntaxhighlight> |
||
=={{header|Ring}}== |
=={{header|Ring}}== |
||
< |
<syntaxhighlight lang="ring"> |
||
# Project : Terminal control/Cursor positioning |
# Project : Terminal control/Cursor positioning |
||
Line 611: | Line 611: | ||
next |
next |
||
see " Hello" |
see " Hello" |
||
</syntaxhighlight> |
|||
</lang> |
|||
Output: |
Output: |
||
<pre> |
<pre> |
||
Line 624: | Line 624: | ||
=={{header|Ruby}}== |
=={{header|Ruby}}== |
||
{{libheader|curses}} |
{{libheader|curses}} |
||
< |
<syntaxhighlight lang="ruby">require 'curses' |
||
Curses.init_screen |
Curses.init_screen |
||
Line 634: | Line 634: | ||
ensure |
ensure |
||
Curses.close_screen |
Curses.close_screen |
||
end</ |
end</syntaxhighlight> |
||
=={{header|Scala}}== |
=={{header|Scala}}== |
||
{{Works with|Ubuntu|14.04}} |
{{Works with|Ubuntu|14.04}} |
||
< |
<syntaxhighlight lang="scala">object Main extends App { |
||
print("\u001Bc") // clear screen first |
print("\u001Bc") // clear screen first |
||
println("\u001B[6;3HHello") |
println("\u001B[6;3HHello") |
||
}</ |
}</syntaxhighlight> |
||
=={{header|Seed7}}== |
=={{header|Seed7}}== |
||
Line 648: | Line 648: | ||
''SetPos'' is based on terminfo respectively the Windows console API. |
''SetPos'' is based on terminfo respectively the Windows console API. |
||
< |
<syntaxhighlight lang="seed7">$ include "seed7_05.s7i"; |
||
include "console.s7i"; |
include "console.s7i"; |
||
Line 662: | Line 662: | ||
# the program waits until Return/Enter is pressed. |
# the program waits until Return/Enter is pressed. |
||
readln; |
readln; |
||
end func;</ |
end func;</syntaxhighlight> |
||
=={{header|Tcl}}== |
=={{header|Tcl}}== |
||
< |
<syntaxhighlight lang="tcl">exec tput cup 5 2 >/dev/tty |
||
puts "Hello"</ |
puts "Hello"</syntaxhighlight> |
||
=={{header|UNIX Shell}}== |
=={{header|UNIX Shell}}== |
||
< |
<syntaxhighlight lang="sh"># The tput utility numbers from zero, so we have subtracted 1 from row and column |
||
# number to obtain correct positioning. |
# number to obtain correct positioning. |
||
tput cup 5 2</ |
tput cup 5 2</syntaxhighlight> |
||
=={{header|Whitespace}}== |
=={{header|Whitespace}}== |
||
Using ANSI escape sequence, where ESC[y;xH moves curser to row y, col x (see below): |
Using ANSI escape sequence, where ESC[y;xH moves curser to row y, col x (see below): |
||
< |
<syntaxhighlight lang="whitespace"> |
||
Line 710: | Line 710: | ||
</syntaxhighlight> |
|||
</lang> |
|||
This solution was generated from the following pseudo-Assembly. |
This solution was generated from the following pseudo-Assembly. |
||
< |
<syntaxhighlight lang="asm">push "Hello" ;The characters are pushed onto the stack in reverse order |
||
push "[6;3H" |
push "[6;3H" |
||
push 27 ;ESC |
push 27 ;ESC |
||
Line 728: | Line 728: | ||
1: |
1: |
||
pop ret ;Pop counter and return</ |
pop ret ;Pop counter and return</syntaxhighlight> |
||
=={{header|XPL0}}== |
=={{header|XPL0}}== |
||
< |
<syntaxhighlight lang="xpl0">include c:\cxpl\codes; \intrinsic 'code' declarations |
||
[Cursor(2, 5); \3rd column, 6th row |
[Cursor(2, 5); \3rd column, 6th row |
||
Text(0, "Hello"); \upper-left corner is coordinate 0, 0 |
Text(0, "Hello"); \upper-left corner is coordinate 0, 0 |
||
]</ |
]</syntaxhighlight> |
||
=={{header|Wren}}== |
=={{header|Wren}}== |
||
< |
<syntaxhighlight lang="ecmascript">System.write("\e[2J") // clear the terminal |
||
System.print("\e[6;3HHello") // move to (6, 3) and print 'Hello'</ |
System.print("\e[6;3HHello") // move to (6, 3) and print 'Hello'</syntaxhighlight> |
||
=={{header|Z80 Assembly}}== |
=={{header|Z80 Assembly}}== |
||
Uses Amstrad CPC, but other machines with similar terminal functions can do the job. (The BIOS calls will be different however.) |
Uses Amstrad CPC, but other machines with similar terminal functions can do the job. (The BIOS calls will be different however.) |
||
< |
<syntaxhighlight lang="z80">ld hl,&0603 ;6 = ROW, 3 = COLUMN |
||
call &BB75 ;set text cursor according to HL |
call &BB75 ;set text cursor according to HL |
||
Line 760: | Line 760: | ||
call &BB5A ;print accumulator as an ascii char to screen |
call &BB5A ;print accumulator as an ascii char to screen |
||
inc hl ;next char |
inc hl ;next char |
||
jr PrintString</ |
jr PrintString</syntaxhighlight> |
||
Line 766: | Line 766: | ||
{{trans|C/C++}} |
{{trans|C/C++}} |
||
Using ANSI escape sequence, where ESC[y;xH moves curser to row y, col x: |
Using ANSI escape sequence, where ESC[y;xH moves curser to row y, col x: |
||
< |
<syntaxhighlight lang="zkl">print("\e[6;3H" "Hello");</syntaxhighlight> |
||
{{omit from|ACL2}} |
{{omit from|ACL2}} |
Revision as of 18:17, 28 August 2022
You are encouraged to solve this task according to the task description, using any language you may know.
- Task
Move the cursor to column 3, row 6, and display the word "Hello" (without the quotes), so that the letter H is in column 3 on row 6.
AArch64 Assembly
/* ARM assembly AARCH64 Raspberry PI 3B */
/* program cursorPos64.s */
/*******************************************/
/* Constantes file */
/*******************************************/
/* for this file see task include a file in language AArch64 assembly*/
.include "../includeConstantesARM64.inc"
/*******************************************/
/* Initialized data */
/*******************************************/
.data
szMessStartPgm: .asciz "Program start \n"
szMessEndPgm: .asciz "Program normal end.\n"
szMessMovePos: .asciz "\033[6;3HHello\n"
szCarriageReturn: .asciz "\n"
szCleax1: .byte 0x1B
.byte 'c' // other console clear
.byte 0
/*******************************************/
/* UnInitialized data */
/*******************************************/
.bss
/*******************************************/
/* code section */
/*******************************************/
.text
.global main
main:
ldr x0,qAdrszMessStartPgm // display start message
bl affichageMess
ldr x0,qAdrszCleax1
bl affichageMess
ldr x0,qAdrszMessMovePos
bl affichageMess
ldr x0,qAdrszMessEndPgm // display end message
bl affichageMess
100: // standard end of the program
mov x0,0 // return code
mov x8,EXIT // request to exit program
svc 0 // perform system call
qAdrszMessStartPgm: .quad szMessStartPgm
qAdrszMessEndPgm: .quad szMessEndPgm
qAdrszCarriageReturn: .quad szCarriageReturn
qAdrszCleax1: .quad szCleax1
qAdrszMessMovePos: .quad szMessMovePos
/********************************************************/
/* File Include fonctions */
/********************************************************/
/* for this file see task include a file in language AArch64 assembly */
.include "../includeARM64.inc"
Action!
PROC Main()
Position(3,6)
Print("Hello")
RETURN
- Output:
Screenshot from Atari 8-bit computer
Ada
with Ada.Text_IO;
procedure Cursor_Pos is
begin
Ada.Text_IO.Set_Line(6);
Ada.Text_IO.Set_Col(3);
Ada.Text_IO.Put("Hello");
end Cursor_Pos;
ARM Assembly
/* ARM assembly Raspberry PI */
/* program cursorPos.s */
/* Constantes */
.equ STDOUT, 1 @ Linux output console
.equ EXIT, 1 @ Linux syscall
.equ WRITE, 4 @ Linux syscall
/* Initialized data */
.data
szMessStartPgm: .asciz "Program start \n"
szMessEndPgm: .asciz "Program normal end.\n"
szMessMovePos: .asciz "\033[6;3HHello\n"
szCarriageReturn: .asciz "\n"
szClear1: .byte 0x1B
.byte 'c' @ other console clear
.byte 0
/* UnInitialized data */
.bss
/* code section */
.text
.global main
main:
ldr r0,iAdrszMessStartPgm @ display start message
bl affichageMess
ldr r0,iAdrszClear1
bl affichageMess
ldr r0,iAdrszMessMovePos
bl affichageMess
ldr r0,iAdrszMessEndPgm @ display end message
bl affichageMess
100: @ standard end of the program
mov r0, #0 @ return code
mov r7, #EXIT @ request to exit program
svc 0 @ perform system call
iAdrszMessStartPgm: .int szMessStartPgm
iAdrszMessEndPgm: .int szMessEndPgm
iAdrszCarriageReturn: .int szCarriageReturn
iAdrszClear1: .int szClear1
iAdrszMessMovePos: .int szMessMovePos
/******************************************************************/
/* display text with size calculation */
/******************************************************************/
/* r0 contains the address of the message */
affichageMess:
push {r0,r1,r2,r7,lr} @ save registers
mov r2,#0 @ counter length */
1: @ loop length calculation
ldrb r1,[r0,r2] @ read octet start position + index
cmp r1,#0 @ if 0 its over
addne r2,r2,#1 @ else add 1 in the length
bne 1b @ and loop
@ so here r2 contains the length of the message
mov r1,r0 @ address message in r1
mov r0,#STDOUT @ code to write to the standard output Linux
mov r7, #WRITE @ code call system "write"
svc #0 @ call system
pop {r0,r1,r2,r7,lr} @ restaur registers
bx lr @ return
Arturo
goto 3 6
print "Hello"
AutoHotkey
Remember that AHK is not built for the console, so we must call the WinAPI directly.
DllCall( "AllocConsole" ) ; create a console if not launched from one
hConsole := DllCall( "GetStdHandle", int, STDOUT := -11 )
DllCall("SetConsoleCursorPosition", UPtr, hConsole, UInt, (6 << 16) | 3)
WriteConsole(hConsole, "Hello")
MsgBox
WriteConsole(hConsole, text){
VarSetCapacity(out, 16)
If DllCall( "WriteConsole", UPtr, hConsole, Str, text, UInt, StrLen(text)
, UPtrP, out, uint, 0 )
return out
return 0
}
Axe
Since the rows and columns are zero-indexed, we must subtract 1 from both.
Output(2,5,"HELLO")
BaCon
' Cursor positioning, requires ANSI compliant terminal
GOTOXY 3,6
PRINT "Hello"
The X Y in GOTOXY
is Column Row order.
BASIC
Applesoft BASIC
10 VTAB 6: HTAB 3
20 PRINT "HELLO"
IS-BASIC
100 PRINT AT 6,3:"Hello"
Locomotive Basic
10 LOCATE 3,6
20 PRINT "Hello"
ZX Spectrum Basic
10 REM The top left corner is at position 0,0
20 REM So we subtract one from the coordinates
30 PRINT AT 5,2 "Hello"
BBC BASIC
PRINT TAB(2,5);"Hello"
Commodore BASIC
100 print chr$(19) :rem change to lowercase set
110 print chr$(14) :rem go to position 1,1
120 print:print:print:print
130 print tab(2) "Hello"
Befunge
Assuming a terminal with support for ANSI escape sequences.
0"olleHH3;6["39*>:#,_$@
Blast
# This will display a message at a specific position on the terminal screen
.begin
cursor 6,3
display "Hello!"
return
# This is the end of the script
C/C++
Using ANSI escape sequence, where ESC[y;xH moves curser to row y, col x:
#include <stdio.h>
int main()
{
printf("\033[6;3HHello\n");
return 0;
}
The C version of the minesweeper game uses curses. Minesweeper_game#C
On Windows, using console API:
#include <windows.h>
int main() {
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
COORD pos = {3, 6};
SetConsoleCursorPosition(hConsole, pos);
WriteConsole(hConsole, "Hello", 5, NULL, NULL);
return 0;
}
C#
static void Main(string[] args)
{
Console.SetCursorPosition(3, 6);
Console.Write("Hello");
}
COBOL
IDENTIFICATION DIVISION.
PROGRAM-ID. cursor-positioning.
PROCEDURE DIVISION.
DISPLAY "Hello" AT LINE 6, COL 3
GOBACK
.
Common Lisp
ncurses
To interface the ncurses C library from Lisp, the croatoan library is used.
(defun cursor-positioning ()
(with-screen (scr :input-blocking t :input-echoing nil :cursor-visible nil)
(move scr 5 2)
(princ "Hello" scr)
(refresh scr)
;; wait for keypress
(get-char scr)))
D
ANSI escape sequences allow you to move the cursor anywhere on the screen. See more at: Bash Prompt HowTo - Chapter 6. ANSI Escape Sequences: Colours and Cursor Movement
Position the Cursor: \033[<L>;<C>H or \033[<L>;<C>f puts the cursor at line L and column C.
import std.stdio;
void main()
{
writef("\033[6;3fHello");
}
Output:
0123456789 1 2 3 4 5 6 Hello 9 8 9
Elena
ELENA 4.x :
public program()
{
console.setCursorPosition(3,6).write("Hello")
}
Euphoria
position(6,3)
puts(1,"Hello")
F#
open System
Console.SetCursorPosition(3, 6)
Console.Write("Hello")
Forth
2 5 at-xy ." Hello"
Fortran
Intel Fortran on Windows
program textposition
use kernel32
implicit none
integer(HANDLE) :: hConsole
integer(BOOL) :: q
hConsole = GetStdHandle(STD_OUTPUT_HANDLE)
q = SetConsoleCursorPosition(hConsole, T_COORD(3, 6))
q = WriteConsole(hConsole, loc("Hello"), 5, NULL, NULL)
end program
FreeBASIC
Locate 6, 3 : Print "Hello"
Sleep
Go
External command
package main
import (
"bytes"
"fmt"
"os"
"os/exec"
)
func main() {
cmd := exec.Command("tput", "-S")
cmd.Stdin = bytes.NewBufferString("clear\ncup 5 2")
cmd.Stdout = os.Stdout
cmd.Run()
fmt.Println("Hello")
}
ANSI escape codes
package main
import "fmt"
func main() {
fmt.Println("\033[2J\033[6;3HHello")
}
Ncurses
package main
import (
"log"
gc "code.google.com/p/goncurses"
)
func main() {
s, err := gc.Init()
if err != nil {
log.Fatal("init:", err)
}
defer gc.End()
s.Move(5, 2)
s.Println("Hello")
s.GetChar()
}
Icon and Unicon
If the OS has older termcap files, CUP is included with link ansi
procedure main()
writes(CUP(6,3), "Hello")
end
procedure CUP(i,j)
writes("\^[[",i,";",j,"H")
return
end
J
Using terminal positioning verbs of Terminal_control/Coloured_text#J
'Hello',~move 6 3
Julia
const ESC = "\u001B"
gotoANSI(x, y) = print("$ESC[$(y);$(x)H")
gotoANSI(3, 6)
println("Hello")
Kotlin
// version 1.1.2
fun main(args: Array<String>) {
print("\u001Bc") // clear screen first
println("\u001B[6;3HHello")
}
Lasso
local(esc = decode_base64('Gw=='))
stdout( #esc + '[6;3HHello')
Liberty BASIC
locate 3, 6
print "Hello"
Logo
setcursor [2 5]
type "Hello
You can also draw positioned text on the turtle graphics window.
setpos [20 50]
setxy 20 30 ; alternate way to set position
label "Hello
Mathematica/Wolfram Language
Run["tput cup 6 3"]
Print["Hello"]
Nim
import terminal
setCursorPos(3, 6)
echo "Hello"
NS-HUBASIC
10 LOCATE 3,6
20 PRINT "HELLO"
OCaml
Using the library ANSITerminal:
#load "unix.cma"
#directory "+ANSITerminal"
#load "ANSITerminal.cma"
module Trm = ANSITerminal
let () =
Trm.erase Trm.Screen;
Trm.set_cursor 3 6;
Trm.print_string [] "Hello";
;;
Pascal
program cursor_pos;
uses crt;
begin
gotoxy(6,3);
write('Hello');
end.
Perl
Using the Term::Cap module:
use Term::Cap;
my $t = Term::Cap->Tgetent;
print $t->Tgoto("cm", 2, 5); # 0-based
print "Hello";
Phix
without js -- position position(6,3) puts(1,"Hello")
PHP
echo "\033[".$x.",".$y."H"; // Position line $y and column $x.
echo "\033[".$n."A"; // Up $n lines.
echo "\033[".$n."B"; // Down $n lines.
echo "\033[".$n."C"; // Forward $n columns.
echo "\033[".$n."D"; // Backward $n columns.
echo "\033[2J"; // Clear the screen, move to (0,0).
PicoLisp
(call 'tput "cup" 6 3)
(prin "Hello")
PowerShell
The following will only work in the PowerShell console host. Most notably it will not work in the PowerShell ISE.
$Host.UI.RawUI.CursorPosition = New-Object System.Management.Automation.Host.Coordinates 2,5
$Host.UI.Write('Hello')
Alternatively, in any PowerShell host that uses the Windows console, one can directly use the .NET Console
class:
[Console]::SetCursorPosition(2,5)
[Console]::Write('Hello')
PureBasic
EnableGraphicalConsole(#True)
ConsoleLocate(3,6)
Print("Hello")
Python
Using ANSI escape sequence, where ESC[y;xH moves curser to row y, col x:
print("\033[6;3HHello")
On Windows it needs to import and init the colorama module first.
ANSI sequences are not recognized in Windows console, here is a program using Windows API:
from ctypes import *
STD_OUTPUT_HANDLE = -11
class COORD(Structure):
pass
COORD._fields_ = [("X", c_short), ("Y", c_short)]
def print_at(r, c, s):
h = windll.kernel32.GetStdHandle(STD_OUTPUT_HANDLE)
windll.kernel32.SetConsoleCursorPosition(h, COORD(c, r))
c = s.encode("windows-1252")
windll.kernel32.WriteConsoleA(h, c_char_p(c), len(c), None, None)
print_at(6, 3, "Hello")
Quackery
[ number$ swap number$
$ 'print("\033[' rot join
char ; join
swap join
$ 'H", end="")' join
python ] is cursor-at ( x y --> )
3 6 cursor-at say "Hello"
Racket
#lang racket
(require (planet neil/charterm:3:0))
(with-charterm
(charterm-clear-screen)
(charterm-cursor 3 6)
(displayln "Hello World"))
Raku
(formerly Perl 6) Assuming an ANSI terminal:
print "\e[6;3H";
print 'Hello';
Retro
with console'
: hello 3 6 at-xy "Hello" puts ;
REXX
The REXX language doesn't have any cursor or screen management tools, but some REXX interpreters have
added the functionality via different methods (such as functions and/or subroutines).
/*REXX program demonstrates moving the cursor position and writing of text to same place*/
call cursor 3,6 /*move the cursor to row 3, column 6. */
say 'Hello' /*write the text at that location. */
call scrwrite 30,50,'Hello.' /*another method, different location. */
call scrwrite 40,60,'Hello.',,,14 /*another method ... in yellow. */
exit 0 /*stick a fork in it, we're all done. */
Ring
# Project : Terminal control/Cursor positioning
for n = 1 to 5
see nl
next
see " Hello"
Output:
Hello
Ruby
require 'curses'
Curses.init_screen
begin
Curses.setpos(6, 3) # column 6, row 3
Curses.addstr("Hello")
Curses.getch # Wait until user presses some key.
ensure
Curses.close_screen
end
Scala
object Main extends App {
print("\u001Bc") // clear screen first
println("\u001B[6;3HHello")
}
Seed7
The function setPos is portable and positions the cursor on the console window. SetPos is based on terminfo respectively the Windows console API.
$ include "seed7_05.s7i";
include "console.s7i";
const proc: main is func
local
var text: console is STD_NULL;
begin
console := open(CONSOLE);
setPos(console, 6, 3);
write(console, "Hello");
# Terminal windows often restore the previous
# content, when a program is terminated. Therefore
# the program waits until Return/Enter is pressed.
readln;
end func;
Tcl
exec tput cup 5 2 >/dev/tty
puts "Hello"
UNIX Shell
# The tput utility numbers from zero, so we have subtracted 1 from row and column
# number to obtain correct positioning.
tput cup 5 2
Whitespace
Using ANSI escape sequence, where ESC[y;xH moves curser to row y, col x (see below):
This solution was generated from the following pseudo-Assembly.
push "Hello" ;The characters are pushed onto the stack in reverse order
push "[6;3H"
push 27 ;ESC
push 11 ;Number of characters to print
call 0 ;Calls print-string function
exit
0:
dup jumpz 1 ;Return if counter is zero
exch prtc ;Swap counter with the next character and print it
push 1 sub ;Subtract one from counter
jump 0 ;Loop back to print next character
1:
pop ret ;Pop counter and return
XPL0
include c:\cxpl\codes; \intrinsic 'code' declarations
[Cursor(2, 5); \3rd column, 6th row
Text(0, "Hello"); \upper-left corner is coordinate 0, 0
]
Wren
System.write("\e[2J") // clear the terminal
System.print("\e[6;3HHello") // move to (6, 3) and print 'Hello'
Z80 Assembly
Uses Amstrad CPC, but other machines with similar terminal functions can do the job. (The BIOS calls will be different however.)
ld hl,&0603 ;6 = ROW, 3 = COLUMN
call &BB75 ;set text cursor according to HL
ld hl,Message
call PrintString
ret ;return to basic
Message:
byte "Hello",0
PrintString:
ld a,(hl) ;read a byte from the string
or a ;check equality to zero
ret z ;if equal to zero, we're done
call &BB5A ;print accumulator as an ascii char to screen
inc hl ;next char
jr PrintString
zkl
Using ANSI escape sequence, where ESC[y;xH moves curser to row y, col x:
print("\e[6;3H" "Hello");
- Programming Tasks
- Terminal control
- AArch64 Assembly
- Action!
- Ada
- ARM Assembly
- Arturo
- AutoHotkey
- Axe
- BaCon
- BASIC
- Applesoft BASIC
- IS-BASIC
- Locomotive Basic
- ZX Spectrum Basic
- BBC BASIC
- Commodore BASIC
- Befunge
- Blast
- C
- C++
- C sharp
- COBOL
- Common Lisp
- Ncurses
- D
- Elena
- Euphoria
- F Sharp
- Forth
- Fortran
- FreeBASIC
- Go
- Curses
- Icon
- Unicon
- J
- Julia
- Kotlin
- Lasso
- Liberty BASIC
- Logo
- Mathematica
- Wolfram Language
- Nim
- NS-HUBASIC
- OCaml
- Pascal
- Perl
- Phix
- PHP
- PicoLisp
- PowerShell
- PureBasic
- Python
- Quackery
- Racket
- Raku
- Retro
- REXX
- Ring
- Ruby
- Scala
- Seed7
- Tcl
- UNIX Shell
- Whitespace
- XPL0
- Wren
- Z80 Assembly
- Zkl
- ACL2/Omit
- GUISS/Omit
- Maxima/Omit
- PARI/GP/Omit
- Scratch/Omit