Sign in Join
Wiki copytemporary

Position the cursor in the console/de: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11Zurück zur [[Console/de|Konsolenseite]].
22
33# Den Cursor in der Konsole positionieren
44
55Dieser Artikel dient der Konsolen- / Terminalprogrammierung unter Windows und Linux.\
66Mit dem Befehl GotoXY kann in der Konsole / Terminal der Cursor an die gewünschte Stelle gesetzt werden.\
77
88``` pascal
99program project1;
1010
1111{$mode objfpc}{$H+}
1212{$IMPLICITEXCEPTIONS OFF}
1313
1414uses
1515 Crt;
1616
1717begin
1818 // Um auf der Konsole Text zu positionieren, sollte man die Konsolenausgaben
1919 // der vorhergehenden Programme löschen.
2020 // Das geschieht mit dem Befehl ClrScr.
2121 ClrScr;
2222
2323 // Positioniert den Cursor in Spalte 1, Zeile 5
2424 GOTOXY(1,6);
2525 Write('Hallo');
2626
2727 // Positioniert den Cursor in Spalte 8, Zeile 1
2828 GOTOXY(8,1);
2929 Write('Welt');
3030 // Setzt den Cursor an das Ende der Programmausgabe.
3131 // Damit erscheint die Komandozeile / der Prompt nicht mitten
3232 // in der eigenen Programmausgabe
3333 GotoXY (1,7);
3434end.
3535```
3636
37-\
3837Die Ausgabe sieht unter Windows so aus:\
3938
4039 Welt
4140
4241 Hallo
4342
4443 C:\Programmierung\Test3>
4544
46-\
4745Die Ausgabe sieht unter Linux so aus:\
4846
4947 Welt
5048
5149 Hallo
5250 /home/gast/Dokumente/Programmierung/Lazarus/Test3$
5351
5452---
5553*From the Free Pascal wiki, page "Position the cursor in the console/de", as it stood on 2020-02-23 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history