comp.lang.ada
 help / color / mirror / Atom feed
From: tore@lis.pitt.edu (Tore Joergensen)
Subject: Re: newbie binary file I/O question
Date: 4 Mar 1995 16:01:48 GMT
Date: 1995-03-04T16:01:48+00:00	[thread overview]
Message-ID: <3ja2tc$dtf@toads.pgh.pa.us> (raw)
In-Reply-To: D4vHw0.LB@nvl.army.mil

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



  reply	other threads:[~1995-03-04 16:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-03-03 16:31 newbie binary file I/O question Dolores Shaffer
1995-03-04 16:01 ` Tore Joergensen [this message]
1995-03-05 23:04 ` Keith Thompson
1995-03-14 16:18 ` Michael M. Bishop
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox