Tema: File of Byte
Ver Mensaje Individual
  #1  
Antiguo 27-05-2010
kdemia kdemia is offline
Miembro
 
Registrado: may 2010
Posts: 109
Reputación: 14
kdemia Va por buen camino
Question File of Byte

que tal.. miren mi problema es el siguiente.. yo lo que quiero es teniendo un codigo hexa en un TEdit pasarlo de alguna manera a byte y hacer un write sobre el archivo

procedure TForm1.FormCreate(Sender: TObject);
var
arc: file of byte;
i: Integer;
begin
AssignFile(arc, 'a.txt');
rewrite(arc);
for i := 1 to Length(Edit1.Text) do
begin
case Edit1.Text[i] of
'1'..'9': write(arc, IntToHex(StrToInt(Edit1.Text[i])));
'A': write(arc, IntToHex(10));
'B': write(arc, IntToHex(11));
'C': write(arc, IntToHex(12));
'D': write(arc, IntToHex(13));
'E': write(arc, IntToHex(14));
'F': write(arc, IntToHex(15));
end;
end;
end;


Esto es lo que tengo.. probe directamente copiando de internet algunos StrToHex y nada.. igualmente me dije en SysUtils y IntToHex devuelve un string asi q no se.. tmb probe con esto:

procedure TForm1.FormCreate(Sender: TObject);
var
arc: file of byte;
i: Integer;
begin
AssignFile(arc, 'a.txt');
rewrite(arc);
for i := 1 to Length(Edit1.Text) do
begin
case Edit1.Text[i] of
'1': write(arc, $1);
'2': write(arc, $2);
'3': write(arc, $3);
'4': write(arc, $4);
'5': write(arc, $5);
'6': write(arc, $6);
'7': write(arc, $7);
'8': write(arc, $8);
'9': write(arc, $9);
'A': write(arc, $A);
'B': write(arc, $B);
'C': write(arc, $C);
'D': write(arc, $D);
'E': write(arc, $E);
'F': write(arc, $F);
end;
end;
end;

y tmp che a ver si alguien me da una manopla XD
Responder Con Cita