Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   Error en Función Encriptar y Desencriptar (https://www.clubdelphi.com/foros/showthread.php?t=81368)

webmasterplc 08-11-2012 12:00:49

Error en Función Encriptar y Desencriptar
 
Buenas estoy tratando de usar esta función para encriptar y desencriptar datos de una tabla, pero me da un error al compilar
[DCC Error] Unit1.pas(27): E2003 Undeclared identifier: 'Str255'

aca esta el codigo
Código Delphi [-]
Const CRIPTPASSWORD   = 9281711.00;

Var   KeyResult       : String;

Function CriptClave ( Signo:ShortInt;Nombre : Str255; Cripto: Real) : String;
Var L,I: Byte;
  S: String;
  Temp: Array[0..255] Of Byte Absolute Nombre;
Begin
  Str(Trunc(Cripto),S);
  L:=Length(Nombre);
  While Length(S)do
    S:=S+S;
  For I:=1 To L Do
    Temp[i]:=Temp[i] + (Ord(S[i])-48)*SigNo;
  CriptClave:= Nombre;
End { CriptClave };

Casimiro Notevi 08-11-2012 12:07:04

Seguramente te falta algún uses o añadir otra unit donde se declara str255
Pon el código completo que lo veamos.

De todas formas prueba a cambiar str255 por string.

webmasterplc 08-11-2012 12:16:49

Código Delphi [-]
unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs;

type
  TForm1 = class(TForm)
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}
Const CRIPTPASSWORD   = 9281711.00;

Var   KeyResult       : String;

Function CriptClave ( Signo:ShortInt;Nombre : Str255; Cripto: Real) : String;
Var L,I: Byte;
    S: String;
    Temp: Array[0..255] Of Byte Absolute Nombre;
Begin
 Str(Trunc(Cripto),S);
 L:=Length(Nombre);
 While Length(S)Do
  S:=S+S;
 For I:=1 To L Do
   Temp[i]:=Temp[i] + (Ord(S[i])-48)*SigNo;
 CriptClave:= Nombre;
End { CriptClave };
end.

Neftali [Germán.Estévez] 08-11-2012 13:05:13

prueba a añadir esto debajo del type.

Código Delphi [-]
  Str255 = String[255];

webmasterplc 08-11-2012 19:07:57

Gracias hermano Funciono al pelo


La franja horaria es GMT +2. Ahora son las 11:35:47.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi