gm2
[Top][All Lists]
Advanced

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

Re: [Gm2] ISO RndFile.OpenOld does not allow read and write


From: SiTex Graphics
Subject: Re: [Gm2] ISO RndFile.OpenOld does not allow read and write
Date: Thu, 24 Jun 2010 15:15:50 -0400

Hi Gaius,

Thanks for the fix.  The OpenOld function now succeeds, but there is
another problem.  Add the following line to the example prior to the
write:

RndFile.SetPos(fi,2);

Create a file named test.txt with at least 8 chars.  The test program
should write the characters hello starting at file position 2;
instead, it writes hello starting at file position 0.

-Scott


On Mon, Jun 7, 2010 at 7:35 AM, Gaius Mulley <address@hidden> wrote:
> SiTex Graphics <address@hidden> writes:
>
>> Hi Gaius,
>>
>> ISO RndFile.OpenOld does not allow read and write on the same channel.
>>  Test module below.  Compile with
>>
>> gm2 -o append -fiso -fmakeall append.mod
>>
>> The test module opens an existing file named test.txt with read and
>> write access and then writes 5 bytes.  At runtime the binary aborts in
>> RawWrite with
>>
>> this file (test.txt) was opened for reading but is now being written
>>
>> Regards,
>> Scott
>>
>>
>> MODULE append;
>>
>> FROM SYSTEM IMPORT ADR;
>> IMPORT IOChan, ChanConsts, RndFile;
>>
>> TYPE
>>   File = IOChan.ChanId;
>>
>> VAR
>>   fi : IOChan.ChanId;
>>   res : ChanConsts.OpenResults;
>>   buf : ARRAY [0..5] OF CHAR;
>>
>> BEGIN
>>   RndFile.OpenOld(fi,"test.txt",RndFile.read+RndFile.write,res);
>>   IF res=ChanConsts.opened THEN
>>     buf:="hello";
>>     IOChan.RawWrite(fi,ADR(buf),5);
>>     RndFile.Close(fi);
>>   END;
>> END append.
>
> Hi Scott,
>
> many thanks for the bug report and test code - now fixed in the latest
> cvs,
>
> regards,
> Gaius
>



reply via email to

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