Ver Mensaje Individual
  #4  
Antiguo 12-04-2011
broly7 broly7 is offline
Miembro
 
Registrado: jun 2008
Posts: 43
Reputación: 0
broly7 Va por buen camino
Cita:
Empezado por escafandra Ver Mensaje
Mira esto.

Saludos.
No tengo ni idea de programar en C jajaja.
De todas formas he encontrado algo parecido que trabaj de forma parecida a la mía pero no consigo que encuentre una cadena de mas de 1 Byte.

Código Delphi [-]
 var
fs: TFileStream;
Buff: Array [0..10239] of Byte; // a 10Kb Array
b: Byte;
FP, MP: Integer; // FilePos and MemoryPos
i: Integer;
ReadBytes: Integer;
begin

fs := TFileStream.Create(Extractfilepath(application.exename)+'prueba.dat', fmOpenReadWrite);

FP := 0;
b := Ord($FF);
while fs.Position < fs.Size do
begin
ReadBytes := fs.Read(Buff, SizeOf(Buff));
// scan the buffer for #FF bytes
for i := 0 to ReadBytes - 1 do
begin
if (Buff[i] = ($AA)) then
begin
// Set the file pointer to the right place
fs.Seek(FP + i, soFromBeginning);
fs.Write(b, 1);
end;
end;
end;
FP := FP + SizeOf(Buff);
// set the file pointer to the start of the next block
fs.Seek(FP, soFromBeginning);
Fs.Free;
end;

Esto cambia todos los hexabytes AA por FF. Pero para una cadena como $AABBCCDD no sé cómo hacerlo =/
Responder Con Cita