comp.lang.ada
 help / color / mirror / Atom feed
* Got me stumped any idea?
@ 1997-10-11  0:00 Robert A. Thompson
  1997-10-13  0:00 ` SSWICM
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Robert A. Thompson @ 1997-10-11  0:00 UTC (permalink / raw)



I have been working on some stuff here recently and thought that Ada
would be a good compiler for the job.  Being it three years since I took
the class I thought I could brush up on my Ada, Familiarize myself with
the ada95 compiler we just put on our network, and get my work done. 
(kill three birds with one stone)  Well this little project is killing
three birds and one human.  ( I didn't realize what a couple of years
can do to one's rememberance of ada)  I have gone out on the web
searching for some pointers on ada95 b/c I was having some problems.  

I have this file:

With Ada.Text_IO; Use Ada.Text_IO;
With Ada.Strings.Unbounded; Use Ada.Strings.Unbounded;
Procedure Compare is

File1 		:	File_type;
File2 		:	File_type;
FileOut		:	File_type;
File1_line	:	String(1..80);

Begin
	Open(File1,In_File,"NetView.dat");
	Create(FileOut, Out_File, "Data.dat");
	
	While (Not End_Of_File(File1)) loop
		Get(File1,File1_line);
		Skip_Line(File1);
		Put_Line(FileOut,File1_Line);
		New_Line(FileOut);
	End Loop;

	Close(File1);
	Close(FileOut);
End Compare;

That I was gonna use to compare two files.  I thought I would check it
along the way to make sure I was doing things right.  I kept getting
some errors so as I said I went out onto the web and found some help. 
One of the AdaPages had this piece of code:


with Ada.Strings.Unbounded, Text_IO, Ustrings;
use  Ada.Strings.Unbounded, Text_IO, Ustrings;

procedure Put_Long is
  -- Print "long" text lines
  Input : Unbounded_String;
begin
  while (not End_Of_File) loop
    Get_Line(Input);
    if Length(Input) > 10 then
      Put_Line(Input);
    end if;
  end loop;
end Put_Long;



I thought it would be perfect..and looked exactly like what I needed.  I
couldn't compile it though.  It would keep giving me errors saying that
I was not passing the right paramters through the Get_line

Get_Line(File1,File1_line);

I corrected this with a Get

Get(File1,File1_line);

Now when I get the lines in and write them out from a simple text file. 
It goes to printing the lines strange into the file almost like

item1       blah blah
    item1       blah blah
        item1       blah blah
            item1       blah blah ....

This goes on untill it eventually wraps around I have yet to figure out
any of these.  problems


IF some one could let me in on why it is giving me these errors, and
evidently tell me what i am forgetting about basic file I/O I would
greatly Appreciate it.

Sincerely,

Robert A. Thompson




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1997-10-15  0:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-10-11  0:00 Got me stumped any idea? Robert A. Thompson
1997-10-13  0:00 ` SSWICM
1997-10-14  0:00 ` Steve O'Neill
1997-10-15  0:00 ` Matthew Heaney
1997-10-15  0:00 ` Anonymous

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