gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gm2] IOChan.RawRead() always seems to return 0


From: SiTex Graphics
Subject: [Gm2] IOChan.RawRead() always seems to return 0
Date: Wed, 4 Nov 2009 14:43:32 -0500

Hi Gaius,

IOChan.RawRead() always seems to return 0 chars read.  See below for
test code, which tries to load chars from a test.txt file.

-Scott


MODULE loadraw;

FROM SYSTEM IMPORT ADR;
IMPORT STextIO, RndFile, TextIO, ChanConsts, IOConsts, IOChan, SWholeIO;

PROCEDURE PrintText(filename : ARRAY OF CHAR);
VAR
  f : IOChan.ChanId;
  res : ChanConsts.OpenResults;
  buf : ARRAY [0..999] OF CHAR;
  nread : CARDINAL;
BEGIN
  RndFile.OpenOld(f,filename,RndFile.read+RndFile.raw,res);
  IF (res=ChanConsts.opened) THEN
    IOChan.RawRead(f,ADR(buf),SIZE(buf),nread);
    IF IOChan.ReadResult(f)=IOConsts.allRight THEN
      STextIO.WriteString("read count = ");
SWholeIO.WriteCard(nread,1); STextIO.WriteLn;
    END;
    RndFile.Close(f);
  END;
END PrintText;

BEGIN
  PrintText("test.txt");
END loadraw.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]