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.
| Old | New | Line | |
|---|---|---|---|
| 1 | 1 | Zurück zur [[Console/de|Konsolenseite]]. | |
| 2 | 2 | ||
| 3 | 3 | # Den Cursor in der Konsole positionieren | |
| 4 | 4 | ||
| 5 | 5 | Dieser Artikel dient der Konsolen- / Terminalprogrammierung unter Windows und Linux.\ | |
| 6 | 6 | Mit dem Befehl GotoXY kann in der Konsole / Terminal der Cursor an die gewünschte Stelle gesetzt werden.\ | |
| 7 | 7 | ||
| 8 | 8 | ``` pascal | |
| 9 | 9 | program project1; | |
| 10 | 10 | ||
| 11 | 11 | {$mode objfpc}{$H+} | |
| 12 | 12 | {$IMPLICITEXCEPTIONS OFF} | |
| 13 | 13 | ||
| 14 | 14 | uses | |
| 15 | 15 | Crt; | |
| 16 | 16 | ||
| 17 | 17 | begin | |
| 18 | 18 | // Um auf der Konsole Text zu positionieren, sollte man die Konsolenausgaben | |
| 19 | 19 | // der vorhergehenden Programme löschen. | |
| 20 | 20 | // Das geschieht mit dem Befehl ClrScr. | |
| 21 | 21 | ClrScr; | |
| 22 | 22 | ||
| 23 | 23 | // Positioniert den Cursor in Spalte 1, Zeile 5 | |
| 24 | 24 | GOTOXY(1,6); | |
| 25 | 25 | Write('Hallo'); | |
| 26 | 26 | ||
| 27 | 27 | // Positioniert den Cursor in Spalte 8, Zeile 1 | |
| 28 | 28 | GOTOXY(8,1); | |
| 29 | 29 | Write('Welt'); | |
| 30 | 30 | // Setzt den Cursor an das Ende der Programmausgabe. | |
| 31 | 31 | // Damit erscheint die Komandozeile / der Prompt nicht mitten | |
| 32 | 32 | // in der eigenen Programmausgabe | |
| 33 | 33 | GotoXY (1,7); | |
| 34 | 34 | end. | |
| 35 | 35 | ``` | |
| 36 | 36 | ||
| 37 | - | ||
| 38 | 37 | Die Ausgabe sieht unter Windows so aus:\ | |
| 39 | 38 | ||
| 40 | 39 | Welt | |
| 41 | 40 | ||
| 42 | 41 | Hallo | |
| 43 | 42 | ||
| 44 | 43 | C:\Programmierung\Test3> | |
| 45 | 44 | ||
| 46 | - | ||
| 47 | 45 | Die Ausgabe sieht unter Linux so aus:\ | |
| 48 | 46 | ||
| 49 | 47 | Welt | |
| 50 | 48 | ||
| 51 | 49 | Hallo | |
| 52 | 50 | /home/gast/Dokumente/Programmierung/Lazarus/Test3$ | |
| 53 | 51 | ||
| 54 | 52 | --- | |
| 55 | 53 | *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).* |
