Autor Beitrag
Niko S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 566
Erhaltene Danke: 10

Win 7, Ubuntu
Lazarus, Turbo Delphi, Delphu 7 PE
BeitragVerfasst: Mo 13.07.09 21:58 
Ich haette da mal ne Frage wie ich das realisiere, dass ich ein Konsolenprogramm habe?
Ich finde irgendwie keine Beispiel und ich wollte halt konkret nen IRCBot erstellen, weiß
aber nicht wie ich das mit der Konsole da hinbekomme..
Hat vielleicht jemand nen Beispiel oder so?
Also nur von nem Konsolenapp, was ich da beachten muss etc?
FinnO
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1331
Erhaltene Danke: 123

Mac OSX, Arch
TypeScript (Webstorm), Kotlin, Clojure (IDEA), Golang (VSCode)
BeitragVerfasst: Mo 13.07.09 22:08 
Datei->neu->weitere->konsolenanwendung
Niko S. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 566
Erhaltene Danke: 10

Win 7, Ubuntu
Lazarus, Turbo Delphi, Delphu 7 PE
BeitragVerfasst: Mo 13.07.09 22:11 
Und wie vermeide ich, dass das Programm immer aus geht?
FinnO
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1331
Erhaltene Danke: 123

Mac OSX, Arch
TypeScript (Webstorm), Kotlin, Clojure (IDEA), Golang (VSCode)
BeitragVerfasst: Mo 13.07.09 22:13 
Keine Ahnung ;)

[ironie]
ausblenden Delphi-Quelltext
1:
2:
3:
4:
while true do
  asm
    nop
  end;

[/ironie]
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Di 14.07.09 08:22 
user profile iconFinnO hat folgendes geschrieben Zum zitierten Posting springen:
[ironie]
ausblenden Delphi-Quelltext
1:
2:
3:
4:
while true do
  asm
    nop
  end;

[/ironie]


user profile iconFinnO: Effizienz ist alles: while true do;

user profile iconNiko S.: In dem Du solange was tust, bis dein Programm beendet werden soll.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Niko S. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 566
Erhaltene Danke: 10

Win 7, Ubuntu
Lazarus, Turbo Delphi, Delphu 7 PE
BeitragVerfasst: Di 14.07.09 11:32 
Eben das war ja meine Frage.
Ich hab das jetzt so gelöst dass ich ein Bool wert habe und der solang die
Schleife aufrecht erhält bis ich "q" eingebe für quit..
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
  while not PrgQuit do
  begin
    ReadLn(aCmd);
    if (aCmd = 'q'then
      prgQuit := True;
  end;

Klappt soweit ganz gut ^^
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Di 14.07.09 14:09 
Was verstehst du unter "ausgehen"? Wenn du damit meinst, dass sich das Konsolenfenster einfach schließt, wenn du es aus der ID startest und du so die Ausgabe nicht sehen kannst, dann schreib als letzte Zeile ein Readln. Dann schließt sich die Konsole erst nach der Eingabe von Return. Oder mach neues Konsolenfenster auf über Start->Ausführen "cmd" und ruf die Anwendung über die Konsole auf.
Niko S. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 566
Erhaltene Danke: 10

Win 7, Ubuntu
Lazarus, Turbo Delphi, Delphu 7 PE
BeitragVerfasst: Di 14.07.09 18:25 
Es geht ja darum dass es ein IRC-BOT in einer Konsole sein soll ^^
Und son Irc-Bot muss halt "aktiv" sein..
Naja und so funktioniert es ja, dass er immer wieder nach nem input fragt, bevor er closed.
FinnO
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1331
Erhaltene Danke: 123

Mac OSX, Arch
TypeScript (Webstorm), Kotlin, Clojure (IDEA), Golang (VSCode)
BeitragVerfasst: Di 14.07.09 18:36 
dann sollte trotzdem ein ReadLn reichen.
Niko S. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 566
Erhaltene Danke: 10

Win 7, Ubuntu
Lazarus, Turbo Delphi, Delphu 7 PE
BeitragVerfasst: Di 14.07.09 19:02 
Hab ich doch?
Nur damit ich halt mehrere Befehle eintippen kann, in einer Schleife, oder ist daran was falsch?
FinnO
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1331
Erhaltene Danke: 123

Mac OSX, Arch
TypeScript (Webstorm), Kotlin, Clojure (IDEA), Golang (VSCode)
BeitragVerfasst: Di 14.07.09 19:59 
jap, frei nach dem Motto:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  Befehl : String;

begin
  { TODO -oUser -cConsole Main : Hier Code einfügen }

while not (Uppercase(Befehl)='EXIT'do
begin
  WriteLn('Hallo, geben Sie "exit" ein, um das Programm zu beenden (nicht case-sensitiv).');
  ReadLn(Befehl);
end;

end.
Niko S. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 566
Erhaltene Danke: 10

Win 7, Ubuntu
Lazarus, Turbo Delphi, Delphu 7 PE
BeitragVerfasst: Di 14.07.09 20:07 
Und was ist jetzt daran falsch?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
  while not PrgQuit do
  begin
    ReadLn(aCmd);
    if (aCmd = 'q'then
      prgQuit := True;
  end;


Da kommen natürlich noch mehrere Befehle hinzu nicht nur der zum Beenden.
Aber das ist doch im Grunde das Selbe oder nicht?