comp.lang.ada
 help / color / mirror / Atom feed
From: shaffer@oliver (Dolores Shaffer)
Subject: newbie binary file I/O question
Date: Fri, 3 Mar 1995 16:31:11 GMT
Date: 1995-03-03T16:31:11+00:00	[thread overview]
Message-ID: <D4vHw0.LB@nvl.army.mil> (raw)

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);
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



-- 
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.



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

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-03-03 16:31 Dolores Shaffer [this message]
1995-03-04 16:01 ` newbie binary file I/O question Tore Joergensen
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