comp.lang.ada
 help / color / mirror / Atom feed
From: "Robert A. Thompson" <stdrat01@unx1.shsu.edu>
Subject: Got me stumped any idea?
Date: 1997/10/11
Date: 1997-10-11T00:00:00+00:00	[thread overview]
Message-ID: <343F77BF.18CA@unx1.shsu.edu> (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




             reply	other threads:[~1997-10-11  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-10-11  0:00 Robert A. Thompson [this message]
1997-10-13  0:00 ` Got me stumped any idea? SSWICM
1997-10-14  0:00 ` Steve O'Neill
1997-10-15  0:00 ` Matthew Heaney
1997-10-15  0:00 ` Anonymous
replies disabled

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