From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,XPRIO autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,366878aecb8dd427,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-02-11 10:43:31 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!syros.belnet.be!news.belnet.be!newsfeed.tpinternet.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mail From: "Micha� Morawski" Newsgroups: comp.lang.ada Subject: Random Access in Ada.Text_IO files Date: Tue, 11 Feb 2003 19:34:06 +0100 Organization: tp.internet - http://www.tpi.pl/ Message-ID: NNTP-Posting-Host: pd35.lodz.cvx.ppp.tpnet.pl X-Trace: atlantis.news.tpi.pl 1044989025 12432 213.77.230.35 (11 Feb 2003 18:43:45 GMT) X-Complaints-To: usenet@tpi.pl NNTP-Posting-Date: Tue, 11 Feb 2003 18:43:45 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Xref: archiver1.google.com comp.lang.ada:34000 Date: 2003-02-11T19:34:06+01:00 List-Id: Hi, I have encountered the following problem My program (one task) constantly writes some information to the file (log). This is simple text line produced every 2 seconds. Sometimes, other task try to analyze the log and the task need to read the same file. This works if files are opened in the "shared=" form. But of course both tasks use different file position pointers. I wrote the simple test program presented below. If shared is in "no" mode - I receive use_errer, If "yes" mode, the file "aaaaaaa" is destroyed by Get (Ascii.null is inserted). After I wrote the simple monitor to separate the operarions I must write either extension of Ada.Text_IO or own module. In the first case I cannot compile the module (I receive the message - it is the system module and cannot be compiled), and my own module have no acces to stream field of File_Type. Can anyone give me some advice? procedure TF is NAZWA_PLIKU : constant String := "aaaaaaa"; task Wr is end Wr; task body Wr is F : File_Type; ch : Character := 'a'; begin Create (F, Out_File, NAZWA_PLIKU, "shared=no"); loop Put (F, ch); ch := Character'Succ (ch); if ch > 'z' then ch := 'a'; end if; delay 0.01; end loop; exception when others => Put_Line ("Blad w zadaniu"); end Wr; P : File_Type; ch : Character; begin delay 3.0; Open (P, In_File, NAZWA_PLIKU, "shared=no"); Reset (P); loop Get (P, ch); Put (ch); delay 0.1; end loop; exception when E : others => Put (Ada.Exceptions.Exception_Information (E) & GNAT.Traceback.Symbolic.Symbolic_Traceback (E)); end TF; -- Michal Morawski