Recent

Author Topic: Filestream To Array  (Read 1903 times)

flywire

  • Jr. Member
  • **
  • Posts: 85
Filestream To Array
« on: March 03, 2015, 01:45:41 pm »
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: [Select]
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

flamer0n

  • Guest
Re: Filestream To Array
« Reply #1 on: March 03, 2015, 01:59:13 pm »
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: [Select]
f_stream.ReadBuffer(CsunData,CsumTo);

edit: and you didn't declare f_stream in the var section
« Last Edit: March 03, 2015, 02:01:29 pm by flamer0n »

 

TinyPortal © 2005-2018