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=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2e1e48cc9f87abf9 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-03-14 08:20:30 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!swrinde!emory!darwin.sura.net!source.asset.com!source.asset.com!not-for-mail From: bishopm@source.asset.com (Michael M. Bishop) Newsgroups: comp.lang.ada Subject: Re: newbie binary file I/O question Date: 14 Mar 1995 11:18:42 -0500 Organization: Asset Source for Software Engineering Technology Message-ID: <3k4fl2$j45@source.asset.com> References: NNTP-Posting-Host: 530tr0 Keywords: sequential_io Date: 1995-03-14T11:18:42-05:00 List-Id: In article , Dolores Shaffer wrote: >procedure nextstep is > >Package byte_io is new sequential_io(intbyte); > >din_file: byte_io.file_type; >value:intbyte; >name_of_file: string(1..80); >name_length : natural; > >begin > text_io.put_line("enter name of file to open"); > text_io.get_line(name_of_file,name_length); > > byte_io.open(din_file, byte_io.file_mode'first, name=>name_of_file); >--IT BOMBS HERE!! >--but byte_io.open(din_file, byte_io.file_mode'first, "filename"); works You might want to try this: byte_io.open (din_file, byte_io.file_mode'first, name => name_of_file(1 .. name_length)); What is probably happening in the code that raises name_error is that the slice name_of_file(name_length + 1 .. name_of_file'last) (i.e., the part of name_of_file that wasn't filled in by get_line) has some junk characters in it and the OS is thinking that those junk characters constitute part of the file name. So the slice name_of_file(1 .. name_length) references only that part of name_of_file that the user entered. Hope this works... -- | Mike Bishop | The opinions expressed here reflect | | bishopm@source.asset.com | those of this station, its management, | | Member: Team Ada | and the entire world. |