Autor Beitrag
sonic159
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 76

Windows XP
BDS 2006 Professional
BeitragVerfasst: So 02.07.06 09:56 
Hallo!

Ich habe ein kleines Problem in meinem Code
zum auslesen der Telnetconsole...

Hier der Code:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
procedure TForm1.Button1Click(Sender: TObject);
var
  Y : String;
  X : Boolean;

begin
  with IdTCPClient1 do
  begin
    Host := Edit1.Text;
    Port := StrToInt(Edit3.Text);
    Connect;

    if Connected then
    begin
      Y := ReadLn;
      if not Y = '[TS]' then // hier ist der Fehler
      begin
        Memo1.Lines.Add('This is not a TeamSpeak Server!');
        X := True;
      end;
    end;
  end;
end;


Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt
Fighter#1
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 787

Win XP, Ubuntu 8.04
Turbo Delphi 2006, Delphi 2005 Pe, Delphi 5 Pe, Netbeans 6.1, Eclipse, Microsoft VisualC#, Dev C++, PHP, HTML, CSS
BeitragVerfasst: So 02.07.06 11:10 
Kommt der Fehler während das Programm läuft oder beim debuggen?
Probier mal
ausblenden Delphi-Quelltext
1:
if y <> '[TS]' Then ...					


Oder ist der Fehler eine Zeile beim ReadLn??
sonic159 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 76

Windows XP
BDS 2006 Professional
BeitragVerfasst: So 02.07.06 12:26 
Der Fehler tritt beim debaggen auf und heißt:

[Pascal Error] Unit1.pas(46): E2015 Operator not applicable to this operand type
[Pascal Fatal Error] Project1.dpr(5): F2063 Could not compile used unit 'Unit1.pas'

--- hilfe ---

P.S: Dein tipp funktioniert nicht so wie die "not" funktion...

MfG: sonic
Fighter#1
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 787

Win XP, Ubuntu 8.04
Turbo Delphi 2006, Delphi 2005 Pe, Delphi 5 Pe, Netbeans 6.1, Eclipse, Microsoft VisualC#, Dev C++, PHP, HTML, CSS
BeitragVerfasst: So 02.07.06 14:16 
Also, das Problem scheint die Not funktion, da sie auf strings nicht anwendbar ist.
du kannst, recht unsauber, halt machen
if y='[TS]' Then else begin ...
sonst fällt mir nichts ein.

Mfg Fighter#1

_________________
Wer andere beherrscht ist stark,
wer sich selbst beherrscht ist mächtig. Lao Tse
alias5000
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2145

WinXP Prof SP2, Ubuntu 9.04
C/C++(Code::Blocks, VS.NET),A51(Keil),Object Pascal(D2005PE, Turbo Delphi Explorer) C# (VS 2008 Express)
BeitragVerfasst: So 02.07.06 14:21 
eigentlich muss sowohl das:
ausblenden Delphi-Quelltext
1:
if y <> '[TS]' then...					

also auch das:
ausblenden Delphi-Quelltext
1:
if not (y = '[TS]'then...					

gehen.
:arrow: ergo muss es an was anderem liegen, oder du hast dich vertippt

Der Fehler tritt übrigends beim kompilieren auf und zwar in Unit1 in Zeile 46:

user profile iconsonic159 hat folgendes geschrieben:
[Pascal Error] Unit1.pas(46): E2015 Operator not applicable to this operand type

Ist das die if... Zeile?

Gruß alias5000

_________________
Programmers never die, they just GOSUB without RETURN
sonic159 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 76

Windows XP
BDS 2006 Professional
BeitragVerfasst: So 02.07.06 14:33 
Also die IF zeile wird Rot makiert und danach erscheinen die Errors!

MfG: sonic
alias5000
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2145

WinXP Prof SP2, Ubuntu 9.04
C/C++(Code::Blocks, VS.NET),A51(Keil),Object Pascal(D2005PE, Turbo Delphi Explorer) C# (VS 2008 Express)
BeitragVerfasst: So 02.07.06 14:41 
Also wie schreibst du diese Zeile jetzt? Mit Klammern und not, oder ohne Klammern und not, oder mit den Ungleichzeichen? Schon alles probiert?

Gruß aus Heilbronn :wink:

Edit:
So ich habs jetzt mal getestet: die zwei von mir genannten Versionen funktionieren. Bei dem not ohne Klammern kommt er durcheinander, ich schätze mal, weil du da einen Boolean-Ausdruck (not) mit einem String in Verbindung setzt und nicht den Boolean-Ausdruck (y='[TS']) mit not.

_________________
Programmers never die, they just GOSUB without RETURN
sonic159 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 76

Windows XP
BDS 2006 Professional
BeitragVerfasst: So 02.07.06 15:44 
Ja ich schreibs so: if not (Y = '[TS]') then...!

Grus aus Hailbronn nach Hailbronn ;)