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,b847a4bf21e6829a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-14 13:42:56 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread4.news.pas.earthlink.net.POSTED!not-for-mail From: Jeffrey Carter Organization: jrcarter commercial-at acm [period | full stop] org User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: windows ada compiler error References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Tue, 14 Oct 2003 20:42:56 GMT NNTP-Posting-Host: 63.184.17.192 X-Complaints-To: abuse@earthlink.net X-Trace: newsread4.news.pas.earthlink.net 1066164176 63.184.17.192 (Tue, 14 Oct 2003 13:42:56 PDT) NNTP-Posting-Date: Tue, 14 Oct 2003 13:42:56 PDT Xref: archiver1.google.com comp.lang.ada:857 Date: 2003-10-14T20:42:56+00:00 List-Id: Andrew wrote: > but I always get the > raised ADA.IO_EXCEPTION.NAME_ERROR : s-fileio.adb:869 > error That means there's a problem with your file name. Most likely, you're trying to open a file that doesn't exist. Since you're creating the file, you probably want to use Create rather than Open. Your code is full of things that indicate you don't understand basic Ada concepts. I'll try to point them out so you can learn about them. I notice that the code has a number of initialized variables that you never assign to. These are called constants, and should be declared as such. For example, > down: Integer:=10; -- down map > acros: INTEGER:=10; -- across map should probably be Down : constant := 10; Across : cosntant := 10; > for i in 1..down loop > for j in 1..acros loop > map_array(i,j):='X'; > end loop; > end loop; You can create a literal for an entire array in Ada: Map_Array := (others => (others => 'X') ); You don't need to assign element by element. In fact, you can do this when you declare the object: Map_Array : Map_Hold (1 .. Down, 1 .. Across) := (others => (others => 'X') ); When you do need to iterate over an array, you don't need to remember what range you declared it with: for I in Map_Array'range (1) loop for J in Map_Array'range (2) loop For a one-dimensional array, you can just use Name'range, without the "(1)". > while FoundExit /= 1 loop This indicates that you don't understand Booleans. You should have Found_Exit : Boolean := False; ... loop exit when Found_Exit; ... Found_Exit := True; A loop with an exit reads better and is easier to understand than while not Found_Exit loop > Open (map_file, out_FILE, "Map"); This fails if a file name "Map" doesn't already exist. > if IS_OPEN(map_file) then If Open fails, an exception is raised (as you have discovered). Therefore, this test will always be true if you get here. You don't need it and it complicates your code. Add an exception handler to deal with the exceptional case. > else > Put_Line("Map file didn't open .. Killing Program"); > end if; [else to the if above] You can never get here. And if you did, you don't kill the program anyway. Finally, your indentation and capitalization seem random. Regular indentation helps the reader see the structure of the program. Regular capitalization and putting underlines between words in identifiers makes your code easier to read. -- Jeff Carter "Death awaits you all, with nasty, big, pointy teeth!" Monty Python & the Holy Grail 20