Ver Mensaje Individual
  #8  
Antiguo 12-11-2007
Avatar de ixMike
ixMike ixMike is offline
Miembro
 
Registrado: feb 2004
Posts: 1.151
Reputación: 22
ixMike Va por buen camino
Hola.

Bueno, es bastante curioso lo que te pasa. Yo implementé este código:

Código Delphi [-]
program leer;

{$APPTYPE CONSOLE}

uses
  Windows, SysUtils;

type

Tpgmf = record
  FilePrint: SmallInt; // 2B
  Version: SmallInt; // 2B
  Count: Integer; // 4B
  BlockFingerPrint: SmallInt; // 2B
  BlockVersion: SmallInt; // 2B
  RecordCount: Integer; // 4B
  RecordSize: Integer; // 4B
  Checksum: Integer; // 4B - Uso Delphi 3 standar y LongWord no me lo reconoce 
  CourseName: array [0..16] of WideChar; // 34B
  WattsSlopePulse: Integer; // 4B
 end;

const
  TAB=#9;

var
  F: File of Tpgmf;
  Dato: Tpgmf;
  Fw: File of Byte;
  W: Byte;
  N: Integer;

begin
  AssignFile(F, ParamStr(1));
  Reset(F);
  Seek(F, 0);
  Read(F, Dato);
  CloseFile(F);
  WriteLn('FilePrint: '+IntToStr(Dato.FilePrint));
  WriteLn('Version: '+IntToStr(Dato.Version));
  WriteLn('Count: '+IntToStr(Dato.Count));
  WriteLn('BlockFingerPrint: '+IntToStr(Dato.BlockFingerPrint));
  WriteLn('BlockVersion: '+IntToStr(Dato.BlockVersion));
  WriteLn('RecordCount: '+IntToStr(Dato.RecordCount));
  WriteLn('CheckSum: '+IntToStr(Dato.CheckSum));
  WriteLn('CouseName: '+String(Dato.CourseName));
  WriteLn('WattsSlopePulse: '+IntToStr(Dato.WattsSlopePulse)+#13#13);
  ReadLn;
  AssignFile(Fw, ParamStr(1));
  Reset(Fw);
//  For N:=0 to FileSize(Fw)-1 do   Esto leería todos los bytes
  For N:=0 to 61 do  //Pero conque lea 62 está bien, es lo que ocupa la estructura
    begin
    Seek(Fw, N);
    Read(Fw, W);
    WriteLn(IntToStr(W)+TAB+IntToHex(W,2)+TAB+Chr(W));
    end;
  CloseFile(Fw);
  ReadLn;
end.

La segunda parte era para ver el balor de los bytes. Efectivamente, después de la cadena de texto (que declaras demasiado larga, tienes que quitarle un carácter, 0..17 son 36 bytes) hay un byte que vale "1", pero que leyéndolo con la estructura no aparece. Me parece que habrá que buscar otra solución (o un buen porqué).

¡Ah! y si encuentras/has encontrado la solución, postéala, no me dejes con las ganas de saber qué pasaba


Saludos.
Responder Con Cita