Ver Mensaje Individual
  #1  
Antiguo 11-07-2008
madmai madmai is offline
Miembro
 
Registrado: oct 2005
Posts: 117
Reputación: 19
madmai Va por buen camino
File of byte y filesize

Código Delphi [-]
var
   f: file of Byte;
   size: Longint;
   S: string;
   y: Integer;
begin
  if OpenDialog1.Execute then
  begin
    AssignFile(f, OpenDialog1.FileName);
    Reset(f);
    try
      size := FileSize(f);
      S := 'File size in bytes: ' + IntToStr(size);
      y := 10;
      Canvas.TextOut(5, y, S);
      y := y + Canvas.TextHeight(S) + 5;
      S := 'Seeking halfway into file...';
      Canvas.TextOut(5, y, S);

      y := y + Canvas.TextHeight(S) + 5;
      Seek(f, size div 2);
      S := 'Position is now ' + IntToStr(FilePos(f));
      Canvas.TextOut(5, y, S);
    finally
      CloseFile(f);
    end;
  end;
end;

Con el siguiente codigo cuando elijo un fichero de mas de 2 gigas me sale un size en negativo que he de hacerlo para interpretarlo, y poner el tamaño real que tiene en megas, cuando es inferior a 2 gigas no tengo problema, gracias de antemano

Última edición por madmai fecha: 11-07-2008 a las 18:38:49.
Responder Con Cita