Registriert seit: 8. Mai 2005
Ort: Sondershausen
4.274 Beiträge
Delphi 6 Personal
|
Re: Fehlermeldung bei Verwendung von AssignFile
2. Dez 2008, 13:45
// Edit: Quark.
Wäre es nicht besser und etwas sicherer noch eine kleine Verschlüsselung der Daten einzubauen ?
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
type
TPassword = record
acData : array[0..255] of char;
acControl : array[0..7] of char;
end;
var
FPassword : File of TPassword;
Password : TPassword;
i : integer;
sCUCMPath : String;
function Moppel(XPasswords: TPassword): TPassword;
var n: integer;
begin
ZeroMemory(@Result, sizeof(TPassword));
for n := 0 to length(XPasswords.acData)-1 do
begin
if n <= length(XPasswords.acControl)-1 then
Result.acControl[n] := chr( n+1 xor ord(XPasswords.acControl[n]) );
Result.acData[n] := chr( n+1 xor ord(XPasswords.acData[n]) );
end;
end;
begin
ZeroMemory(@Password, sizeof(TPassword));
Password.acData := 'Heidi Müller';
Password.acControl := 'DATABASE';
Password := Moppel(Password);
sCUCMPath := 'C:';
AssignFile(FPassword, sCUCMPath + '\Users\Admin-User\Desktop\cucm32.cpw');
rewrite(FPassword);
write(FPassword, Password);
CloseFile(FPassword);
showmessage(format('acData: %s'#13'acControl: %s', [Password.acData, Password.acControl]));
// lesen
AssignFile(FPassword, sCUCMPath + '\Users\Admin-User\Desktop\cucm32.cpw');
reset(FPassword);
read(FPassword, Password);
CloseFile(FPassword);
Password := Moppel(Password);
showmessage(format('acData: %s'#13'acControl: %s', [Password.acData, Password.acControl]));
end;
|
|
Zitat
|