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 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: How to write "Hello" to a text file without a line terminator Date: Sat, 13 Aug 2016 11:03:42 -0700 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <2cc97e17-313e-44b8-b335-8d5e815e925a@googlegroups.com> <4c49991e-9001-464f-afbb-3fcbf78e5656@googlegroups.com> <41b076f1-66b0-4142-8b91-0e717b6176c2@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Date: Sat, 13 Aug 2016 18:03:50 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="d7c030f56102b58a2c16dea977db88bb"; logging-data="6150"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19YR5IuXqLTDQF+IE2SXQtWsQrJ3oJt5bo=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 In-Reply-To: <41b076f1-66b0-4142-8b91-0e717b6176c2@googlegroups.com> Cancel-Lock: sha1:OsJbOOUtnnRnx0sZOpqwInvKu2A= Xref: news.eternal-september.org comp.lang.ada:31425 Date: 2016-08-13T11:03:42-07:00 List-Id: On 08/13/2016 02:12 AM, AdaMagica wrote: > > No, it's not spaces, it's the length of the string output: Since (on my machine), Integer'Size=32, it's four bytes. > Let'say, yout output > Write (f, "abcdef"); > You'll get (in bytes): > 6 0 0 0 97 98 99 100 101 102 > And for a length of 256, you'll get: > 0 1 0 0 ... I was thinking 2 4-byte bounds, but on my 64-bit machine with 32-bit Integer, I get a 6 followed by 7 zeros: with Ada.Sequential_IO; with Ada.Text_IO; procedure Str_Seq_IO is package Str_IO is new Ada.Sequential_IO (Element_Type => String); File : Str_IO.File_Type; begin -- Str_Seq_IO Ada.Text_IO.Put_Line (Item => Integer'Image (Integer'Size) ); Str_IO.Create (File => File, Mode => Str_IO.Out_File, Name => "junk"); Str_IO.Write (File => File, Item => "abcdef"); Str_IO.Close (File => File); end Str_Seq_IO; $ ./str_seq_io 32 $ hd junk 00000000 06 00 00 00 00 00 00 00 61 62 63 64 65 66 |........abcdef| 0000000e -- Jeff Carter "Who wears beige to a bank robbery?" Take the Money and Run 144