Delphi-PRAXiS
Seite 1 von 2  1 2      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Programmieren allgemein (https://www.delphipraxis.net/40-programmieren-allgemein/)
-   -   Inkompatible Typen: AnsiChar und Char (https://www.delphipraxis.net/190148-inkompatible-typen-ansichar-und-char.html)

strom 4. Sep 2016 12:09

Inkompatible Typen: AnsiChar und Char
 
Hallo,
möchte das codierte Passwort wieder in klartext darstellen.
Jetzt kommt die fehlermeldung Inkompatible Typen AnsiChar und Char?


Delphi-Quellcode:
    SL := TStringList.Create;
  try
    SL.LoadFromFile(ExtractFilePath(ParamStr(0)) + 'Password.dat');
    if SL.Count>0 then
      Edit6.Text:=SL[0];
        s := Edit6.Text;
    for y := 1 to Length(s) do s[y] := Char(23 xor Ord(c[y])); // Hier ist das Problem

nahpets 4. Sep 2016 12:39

AW: Inkompatible Typen: AnsiChar und Char
 
Wie sind denn y, s und c definiert?

strom 4. Sep 2016 12:41

AW: Inkompatible Typen: AnsiChar und Char
 
Delphi-Quellcode:
procedure TForm1.FormCreate(Sender: TObject);
var
 i :integer;
 SL: TStrings;
 s: String[255];
 c: array[0..255] of Byte absolute s;

nahpets 4. Sep 2016 12:43

AW: Inkompatible Typen: AnsiChar und Char
 
Versuchs mal mit
Delphi-Quellcode:
  for y := 1 to Length(s) do s[y] := Chr(23 xor Ord(c[y]));
Das "Gegenstück" von Ord ist Chr und nicht Char.

himitsu 4. Sep 2016 12:50

AW: Inkompatible Typen: AnsiChar und Char
 
Die wichtigsten Infos hat jemand vergessen:

Welche Delphi-Verison
und wie ist S deklariert?

strom 4. Sep 2016 12:52

AW: Inkompatible Typen: AnsiChar und Char
 
leider bleibt die Fehlermeldung gleich :-(

Starter Version Berlin 10.1

nahpets 4. Sep 2016 13:01

AW: Inkompatible Typen: AnsiChar und Char
 
Irgendwie erscheint mir das Ganze nicht so recht sinnvoll.

s ist ein String und c ist ein Array an der Adresse von s.

Damit sind s und c inhaltlich gleich.

Eigentlich hätte ich hier eher sowas erwartet:
Delphi-Quellcode:
for y := 1 to Length(s) do s[y] := Chr(23 xor Ord(s[y]));

strom 4. Sep 2016 13:09

AW: Inkompatible Typen: AnsiChar und Char
 
ja, werde noch ein wenig testen!
danke für Eure Hilfe!

himitsu 4. Sep 2016 13:21

AW: Inkompatible Typen: AnsiChar und Char
 
Zitat:

Zitat von nahpets (Beitrag 1346725)
s ist ein String

Jain.

Das wurde immernoch nicht gesagt, aber nach der Berlin-Info denke ich fast an einen AnsiString. :roll:

nahpets 4. Sep 2016 13:30

AW: Inkompatible Typen: AnsiChar und Char
 
Zitat:

Zitat von himitsu (Beitrag 1346729)
Zitat:

Zitat von nahpets (Beitrag 1346725)
s ist ein String

Jain.

Das wurde immernoch nicht gesagt, aber nach der Berlin-Info denke ich fast an einen AnsiString. :roll:

Laut Post #3 ist's
Delphi-Quellcode:
s : String[255];
Ist das jetzt unter Berlin anders als unter Delphi 7? Kenne nur das "alte" Delphi ;-)


Alle Zeitangaben in WEZ +1. Es ist jetzt 04:01 Uhr.
Seite 1 von 2  1 2      

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz