From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.5 required=3.0 tests=BAYES_05,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.6 X-Received: by 2002:a05:620a:2401:b0:67c:85ef:7122 with SMTP id d1-20020a05620a240100b0067c85ef7122mr2228206qkn.293.1646725530375; Mon, 07 Mar 2022 23:45:30 -0800 (PST) X-Received: by 2002:a25:b9d2:0:b0:628:a85f:953c with SMTP id y18-20020a25b9d2000000b00628a85f953cmr10964106ybj.312.1646725530201; Mon, 07 Mar 2022 23:45:30 -0800 (PST) Path: eternal-september.org!reader02.eternal-september.org!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 7 Mar 2022 23:45:30 -0800 (PST) Injection-Info: google-groups.googlegroups.com; posting-host=94.60.27.164; posting-account=3cDqWgoAAAAZXc8D3pDqwa77IryJ2nnY NNTP-Posting-Host: 94.60.27.164 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <1bd9b7ee-9195-44b3-8de2-c018a44b7eden@googlegroups.com> Subject: Get_Immediate does not read CR in CRLF pairs From: Marius Amado-Alves Injection-Date: Tue, 08 Mar 2022 07:45:30 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:63582 List-Id: Behaviour of Ada.Text_IO on GNAT/Windows 11: (1) Get_Immediate does not read the CR in CRLF pairs (2) Get_Immediate does not read the ending CRLF pair at all (in loop terminated upon End_Of_File) (3) an extra ending CRLF pair is output Does this behaviour follow from the ARM? Do other compilers behave 'better'? Sequential_IO instantiated with Character works correctly (so I am not blocked, just curious:-) Thanks. ______ with Ada.Text_IO; use Ada.Text_IO; procedure Get_Immediate_Test is C: Character; F_In: File_Type; F_Out: File_Type; procedure Default_Files_With_End_Of_File is begin while not End_Of_File loop Get_Immediate (C); Put (Character'Pos (C)'Img); end loop; end; procedure Default_Files_With_Exception is begin loop Get_Immediate (C); Put (Character'Pos (C)'Img); end loop; exception when others => null; end; procedure Named_Files_With_End_Of_File is begin Open (F_In, In_File, "imm_test_in_file.txt"); Create (F_Out, Out_File, "imm_test_out_file.txt"); while not End_Of_File loop Get_Immediate (F_In, C); Put (F_Out, Character'Pos (C)'Img); end loop; Close (F_In); Close (F_Out); end; procedure Named_Files_With_Exception is begin Open (F_In, In_File, "imm_test_in_file.txt"); Create (F_Out, Out_File, "imm_test_out_file.txt"); begin loop Get_Immediate (F_In, C); Put (F_Out, Character'Pos (C)'Img); end loop; exception when others => Close (F_In); Close (F_Out); end; end; begin Named_Files_With_Exception; end;