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-04 20:19:01 PST Path: bga.com!news.sprintlink.net!cs.utexas.edu!swrinde!gatech!newsfeed.pitt.edu!toads.pgh.pa.us!tore From: tore@lis.pitt.edu (Tore Joergensen) Newsgroups: comp.lang.ada Subject: Re: newbie binary file I/O question Date: 4 Mar 1995 16:01:48 GMT Organization: University of Pittsburgh Message-ID: <3ja2tc$dtf@toads.pgh.pa.us> References: NNTP-Posting-Host: thrasher.lis.pitt.edu X-Newsreader: TIN [version 1.2 PL2] Date: 1995-03-04T16:01:48+00:00 List-Id: Dolores Shaffer (shaffer@oliver) wrote: : Hi, : I am using an old Telesoft Ada compiler on a Sun workstation. I have : a binary file that I would like to open and read one byte at a time. : If the code asks the user for the file name and then stores that in : a string variable, and the code passes that variable to the open : procedure, I get a NAME_ERROR and the code bombs. If the code : passes the name of the binary file in quotes, it works. I am : able to use text_io.open to open text files whose names are passed to : open in a string variable. Any suggestions? : Here is part of the code: : with text_io; : with sequential_io; : 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); Try name_of_file: string(1..80) := (others => ' '); and if that doesn't work, try : 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); byte_io.open(din_file, byte_io.file_mode'first, name=>name_of_file(1..name_length)); : --IT BOMBS HERE!! : --but byte_io.open(din_file, byte_io.file_mode'first, "filename"); works : -- : D. A. Shaffer, shaffer@nvl.army.mil : Night Vision & Electronic Sensors Directorate : DISCLAIMER: facts & opinions expressed are not necessarily those : of Night Vision & Electronic Sensors Directorate. -- ______________________________________________________________________ Tore B. Joergensen, | e-mail: tore@lis.pitt.edu a norwegian student | snail-mail: 2201 Pittockstr. a long way from home. | Pittsburgh, 15217 PA | web: http://www.pitt.edu/~tojst1