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=-0.8 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,ba0587ecc5989bed,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-03-25 10:50:07 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!deine.net!freenix!enst!enst.fr!not-for-mail From: Erik Sigra Newsgroups: comp.lang.ada Subject: Another problem with stream reading. Date: Mon, 25 Mar 2002 19:53:36 +0100 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Trace: avanie.enst.fr 1017082206 64527 137.194.161.2 (25 Mar 2002 18:50:06 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Mon, 25 Mar 2002 18:50:06 +0000 (UTC) Return-Path: X-Mailer: KMail [version 1.3.2] Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.8 Precedence: bulk X-Reply-To: sigra@home.se List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:21649 Date: 2002-03-25T19:53:36+01:00 Now I have the program with Ada; use Ada; with Text_IO; use Text_IO; with Ada.Streams; use Streams; with Ada.Streams.Stream_IO; use Stream_IO; procedure Streamtest is The_File : Stream_IO.File_Type; begin Open (The_File, In_File, "data"); declare The_Stream : Stream_Access := Stream (The_File); type Byte is range 0 .. 255; for Byte'Size use 8; B : Byte; begin while not End_Of_File (The_File) loop Byte'Read (The_Stream, B); Put_Line ("Read B = " & B'Img); end loop; end; end Streamtest; The data file contains "����" (hexadecimal "ff fe fd fc") (decimal "255 254 253 252). The output of the program is: Read B = 255 Read B = 253 The problem is that it reads 2 bytes instead of 1 and thus skips each second byte. Why?