文件名称 win.wil 
内容是用ultraedit打开显示为16进制00 00 00 00 00 00 00 00 00 00 00 63 00 00 00 00
0A 00 00 00 00 00 00 00 7A 00 00 63 00 00 00 00
0C 00 4A 58 43 53 4F 46 54 4B 45 59 49 44 32 38
31 36 32 35 36 35 30 00 1Aascii显示为           c           z        JXCSOFTKEYID281625650 1,想读取其内容显示在EDIT1.TEXT或MEMEO1上
2,读取46到54的内容显示在EDIT1.TEXT上

解决方案 »

  1.   

    FileCreate - FileOpen - FileSeek - FileRead - FileClose
      

  2.   

    http://www.swissdelphicenter.ch/torry/showcode.php?id=944
    Tip Rating (26):   
    type
      TDisplayProc = procedure(const s: string) of object;procedure ShowBinary(var Data; Count: Cardinal; DispProc: TDisplayProc);implementation
    procedure ShowBinary(var Data; Count: Cardinal; DispProc: TDisplayProc);
    var
      line: string[80];
      i: Cardinal;
      p: PChar;
      nStr: string[4];
    const
      posStart = 1;
      binStart = 7;
      ascStart = 57;
      HexChars: PChar = '0123456789ABCDEF';
    begin
      p    := @Data;
      line := '';
      for i := 0 to Count - 1 do
      begin
        if (i mod 16) = 0 then
        begin
          if Length(line) > 0 then
            DispProc(line);
          FillChar(line, SizeOf(line), ' ');
          line[0] := Chr(72);
          nStr    := Format('%4.4X', [i]);
          Move(nStr[1], line[posStart], Length(nStr));
          line[posStart + 4] := ':';
        end;
        if p[i] >= ' ' then
          line[i mod 16 + ascStart] := p[i]
        else
          line[i mod 16 + ascStart] := '.';
        line[binStart + 3 * (i mod 16)]     := HexChars[(Ord(p[i]) shr 4) and $F];
        line[binStart + 3 * (i mod 16) + 1] := HexChars[Ord(p[i]) and $F];
      end;
      DispProc(line);
    end;
    procedure TForm1.Display(const S: string);
    begin
      Memo1.Lines.Add(S);
    end;procedure TForm1.Button1Click(Sender: TObject);
    var
      ms: TMemoryStream;
    begin
      if Opendialog1.Execute then
      begin
        ms := TMemoryStream.Create;
        try
          ms.LoadFromfile(OpenDialog1.FileName);
          ShowBinary(ms.Memory^, ms.Size, Display);
        finally
          ms.Free
        end;
      end;
    end;
      

  3.   

    var
        F:File;
        Buffer:array[0..300] of byte;
        i,Num:integer;
    ......
    for i:=0 to 300 do
       Buffer[i]:=0;
    AssignFile(F,'win.wil');
    Reset(F);
    i:=0;
    BlockRead(F,Buffer,2,Num);  //将文件内容读入Buffer,之后再处理就行了
      

  4.   

    查了一些资料
    procedure TForm1.Button1Click(Sender: TObject);
             var     m: TmemoryStream;
    begin
    m:= TmemoryStream.Create;
    m.loadFromFile('c:\windows\win.wil');
    m.Free;
    end;    
    怎么显示所有内容到memo1上呢?
    怎么显示 该文件中的46到54字节的内容到edit1.text上呢?或者读取其对应数字到281625650edit1.text上,谢谢前几位的说明
      

  5.   

    即是想读取c:\windows\win.wil文件的内容,让她显示到edit1.text中