write to the console/de
Zurück zur Konsolenseite.
Ausgabe auf die Konsole
Dieser Artikel dient der Konsolen- / Terminalprogrammierung unter Windows und Linux.
Wenn Sie also eine Anwendung für Konsole / Terminal erstellen und Sie wollen, dass das Programm nicht nur still vor sich hin arbeitet, dann benötigt das Programm eine Ausgabe an der Konsole / Terminal.
Zum Schreiben auf die Konsole / Terminal gibt es zwei Befehle:
- Write
- WriteLn
Der Unterschied zwischen den beiden Befehlen besteht darin, dass der Befehl 'Write# alle Ausgaben aneinander reiht.
Der Befehl WriteLn macht nach jeder Ausgabe einen Zeilenumbruch.
Wie kann man sich das Vorstellen?
Beispiel für den Befehl Write:
program Project1;
{$mode objfpc}{$H+}
{$IMPLICITEXCEPTIONS OFF}
var
intI: Integer;
begin
for intI := 1 to 10 do
Write('Hallo Welt!');
end.Das obige Beispiel ergibt eine Ausgabe, die wie folgt aussieht:
Hallo Welt!Hallo Welt!Hallo Welt!Hallo Welt!Hallo Welt!Hallo Welt!Hallo Welt!Hal
lo Welt!Hallo Welt!Hallo Welt!
Beispiel für den Befehl WriteLn:
program Project1;
{$mode objfpc}{$H+}
{$IMPLICITEXCEPTIONS OFF}
var
intI: Integer;
begin
for intI := 1 to 10 do
WriteLn('Hallo Welt!');
end.Das obige Beispiel ergibt eine Ausgabe, die wie folgt aussieht:
Hallo Welt!
Hallo Welt!
Hallo Welt!
Hallo Welt!
Hallo Welt!
Hallo Welt!
Hallo Welt!
Hallo Welt!
Hallo Welt!
Hallo Welt!From the Free Pascal wiki, page "write to the console/de", as it stood on 2020-03-04 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.
Edited on wiki.freepascal.org by 2 people, 2014–2020
From the official wiki's backup of 26 May 2024: who edited this page there, and when. Edits made there after that date were not recorded, and the earlier versions are not shown here; the main page says why.
| When | Who | What changed |
|---|---|---|
| Olaf | Created page | |
| Olaf | (minor) | |
| Olaf | (minor) | |
| Olaf | (minor) | |
| Trev | Fixed syntax highlighting; deleted category included in page template (minor) |
Talk about this page
Nobody has opened a bench for this page yet. Sign in to open one.
