[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
'Follow up question'
From: |
Rudolf Schubert |
Subject: |
'Follow up question' |
Date: |
Sun, 16 Apr 2023 21:42:43 +0200 (CEST) |
Hi,
I'm digging a bit further into gm2 and I think there is a problem with
SeqFile.OpenAppend. Instead of appending data when using IOChan.RawWrite
writing data starts from the beginning of the file. Here is my short
test program:
MODULE port_test5_gm2;
FROM ChanConsts IMPORT
OpenResults, old, raw, write;
FROM IOChan IMPORT
ChanId, RawWrite;
FROM StdChans IMPORT
StdOutChan;
FROM SYSTEM IMPORT
ADR;
IMPORT StreamFile;
IMPORT SeqFile;
PROCEDURE IoTest();
CONST
arr_len= 16;
TYPE
arr_type= ARRAY[0..arr_len-1] OF CHAR;
VAR
cid_file: ChanId;
file_name: arr_type;
res: OpenResults;
array: arr_type;
c1: CARDINAL;
BEGIN (* PROCEDURE IoTest *)
file_name:='test_data';
(* initialize array for first write operation with upper case letters *)
FOR c1:=0 TO arr_len-1 DO
array[c1]:=CHR(65+c1);
END; (* FOR c1 *)
(* write arr_len characters to file *)
StreamFile.Open(cid_file, file_name, write+old+raw, res);
IF res=opened THEN
RawWrite(cid_file, ADR(array), arr_len);
StreamFile.Close(cid_file);
END; (* IF res=opened *)
(* initialize array for second write operation with lower case letters *)
FOR c1:=0 TO arr_len-1 DO
array[c1]:=CHR(65+32+c1);
END; (* FOR c1 *)
(* append (arr_len DIV 2) characters to file *)
SeqFile.OpenAppend(cid_file, file_name, write+old+raw, res);
(*
SeqFile.OpenWrite(cid_file, file_name, write+old+raw, res);
*)
IF res=opened THEN
RawWrite(cid_file, ADR(array), arr_len DIV 2);
SeqFile.Close(cid_file);
END; (* IF res=opened *)
END IoTest;
BEGIN (* MODULE port_test5_gm2 *)
IoTest();
END port_test5_gm2.
If I use SeqFile.OpenWrite instead of SeqFile.OpenAppend the result
is the same. So ist seems SeqFile.OpenAppend behaves exactly as
SeqFile.OpenWrite which sould not be the case.
This is with the latest version of gm2 under Debian sid:
gm2 (GCC) 13.0.1 20230414 (experimental)
BR
Rudolf
--
Rudolf Schubert \
Kirchstr. 18a \ mailto:rudolf@muc.de
82054 Sauerlach > http://www.dose.muc.de
Deutschland /
Tel. 08104/908311 /
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- 'Follow up question',
Rudolf Schubert <=