Ver Mensaje Individual
  #1  
Antiguo 07-09-2007
scriptors scriptors is offline
Registrado
 
Registrado: sep 2007
Posts: 5
Reputación: 0
scriptors Va por buen camino
read string from offset - upgrade needed

Código Delphi [-]
 
Function TMainForm.ReadFromOffset(const RAWFile: String; OffsetI: integer;BlockLength:Integer): string;
var
  RAW: file;
  BytesRead: integer;
  RAWData: array[1..5000] of char;
  I: integer;
  c: pointer;
  return: string;
  begin
  BytesRead := -1;
  return := '';
  AssignFile(RAW, RAWFile);
  Reset(RAW,1);
  for I := 0 to OffSetI - 1 do
    Blockread(RAW,c,1);
  BlockRead(RAW,RAWData,BlockLength,BytesRead);
  for I := 1 to BlockLength do
    return := return + RAWData[i];
  ReadFromOffset := return;
  CloseFile(RAW);
  end;

I use this for read byte from datafile at offset and have result one string
this work but are really time expensive if i need to meke more search

I think because it search all file for go to 'offset'

someone can upgrade this routine ?
Responder Con Cita