Forum > General

Filestream To Array

(1/1)

flywire:
I am going in circles and would appreciate a comment. I am trying to load words from a file into the CsumData word array.



--- Code: ---var
  i, Errflag : integer;
  CsumFrom, CsumTo: LongInt;
  Csum: word;
  CsumData: packed array[0..42] of word;
...
begin
  f_stream := TFileStream.Create('Demo.fil', fmOpenRead);
  f_stream.Position:=0;

  // Toc checksum
  Csum := 0;
  Errflag := 0;
  CsumFrom := 0;
  CsumTo := 14;
  CsumData := TFilestream.ReadBuffer(CsumFrom,CsumTo);  // *** This Line
  CheckSumCalc(Csum, CsumData, Errflag);

...
end

--- End code ---

flamer0n:
I think you're using it wrong because [.ReadBuffer] is not a class function that can be used statically. I guess you're trying to achieve this


--- Code: ---f_stream.ReadBuffer(CsunData,CsumTo);
--- End code ---


edit: and you didn't declare f_stream in the var section

Navigation

[0] Message Index

Go to full version