From: wisniews@saifr00.cfsat.honeywell.com (Joe Wisniewski)
Subject: Re: ADA help Urgently Requested..Please!!!!
Organization: Honeywell Air Transport Systems Division
Date: Wed, 2 Sep 92 20:04:37 GMT

In article <1992Sep1.211014.1@vmsclst1.sc.csupomona.edu> mgeorgy@vmsclst1.sc.csupomona.edu writes:
>Hello, the program that follows began as a simple imaging program that I was
>writing for myself.  But now it has become a big problem.  Everything ok except
>the file opening and creating.  When I run the program and select option 1 or
>2, open or create a file, I get a DEVICE ERROR.  I can tell you what is
>happening but I just don't know why.  What is happening is that when it get to
>the GET_LINE statment it uses IN_FILE_NAME's decleration of ' '.  Now I should
>tell anyone willing to help me that the statments work alone but not as part of
>another program (ie, IF statment, or sub-PROCEDURES).  I have raked my brain
>and tried everything.  
>
>SOMEONE PLEASE HELP ME!!!!!!
>
>THANX FOR ANY HELP,
>Matt Georgy
>California Polytechnic State University, Pomona  -- Computer Science
>
>+++++++++++++++++++++++++++++++++++++++++++++++++++++++
>+  Cal Poly, Pomona, Making Yesterdays Mistakes Today +
>+++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
>
>P.S. Please reply by posting to the news group our mail system is screwed up
>right now.
>
>THANX AGAIN.
>
>-------------------------------------------------------------------------------
>with TEXT_IO, INTEGER_TEXT_IO, SEQUENTIAL_IO;
>use TEXT_IO, INTEGER_TEXT_IO;
>
>procedure IMAGE is
>   
>type BYTE is range 0..255;
>for BYTE'size use 8;
>
>package BYTE_IO is new SEQUENTIAL_IO(BYTE);
>use BYTE_IO;
>
>   type BYTE_STRING is ARRAY (1..512) of BYTE;
>
>   INF                  :  BYTE_IO.FILE_TYPE;
>   IN_FILE_NAME         :  STRING (1..80) := (others => ' ');
>   INPUT_LINE_LENGTH    :  INTEGER := 0;
>   IN_FILE_OPEN         :  BOOLEAN := FALSE;
>   
>   OUTF                 :  BYTE_IO.FILE_TYPE;
>   OUT_FILE_NAME        :  STRING (1..80) := (others => ' ');
>   OUTPUT_LINE_LENGTH   :  INTEGER := 0;
>   OUT_FILE_OPEN        :  BOOLEAN := FALSE;
>   
>   READ_BYTE            :  BYTE;
>   READ_STRING          :  BYTE_STRING;
>   COUNTER              :  INTEGER := 0;   
>   SELECTION            :  INTEGER := 1;
>   
>   procedure IMAGING_MENU is
>   
>   begin
>   
>      NULL;
>	  
>   end IMAGING_MENU;
>   
>begin
>
>   while SELECTION /= 0 loop    
>  	  PUT("STATUS:     INPUT FILE: ");
>      if IN_FILE_NAME(1) = ' ' then
>	     PUT("<NONE>");
>      else
>         PUT(IN_FILE_NAME);
>		 IN_FILE_OPEN := TRUE;
>      end if;
>   	  PUT("        ");
>      PUT("   OUTPUT FILE: ");
>	  if OUT_FILE_NAME(1) = ' ' then
>	     PUT("<NONE>");
>	  else
>	     PUT(OUT_FILE_NAME);
>		 OUT_FILE_OPEN := TRUE;
>   	  end if;
>	  NEW_LINE(2);
>	  PUT("          Welcome to POLY-Vision");
>	  NEW_LINE(3);
>	  PUT_LINE("                 MAIN MENU");
>	  NEW_LINE;
>	  PUT_LINE("          (1) Get Input Filename");
>	  NEW_LINE;
>	  PUT_LINE("          (2) Get Output Filename");
>	  NEW_LINE;
>   	  PUT_LINE("          (3) Begin Image Processing");
>	  NEW_LINE;
>	  PUT_LINE("          (0) Exit POLY-Vision");
>	  NEW_LINE(2);
>      PUT_LINE("                   CHOICE: ");
>	  GET(SELECTION);
>	  if SELECTION = 1 then
>         PUT_LINE("INPUT FILE NAME: ");
>         GET_LINE(IN_FILE_NAME, INPUT_LINE_LENGTH);
>	     open(INF, IN_FILE, IN_FILE_NAME(1..INPUT_LINE_LENGTH));
>	  elsif SELECTION = 2 then
>         PUT("OUTPUT FILE NAME: ( ");
>         PUT(IN_FILE_NAME(1..INPUT_LINE_LENGTH - 3));
>         PUT_LINE("NEW )");
>         GET_LINE(OUT_FILE_NAME, OUTPUT_LINE_LENGTH);
>         if OUT_FILE_NAME(1) = ' ' then
>            create(OUTF, OUT_FILE, IN_FILE_NAME(1..INPUT_LINE_LENGTH - 3) & "NEW");
>         else
>            create(OUTF, OUT_FILE, OUT_FILE_NAME(1..OUTPUT_LINE_LENGTH));
>         end if; 
>	  elsif SELECTION = 3 then
>	     IMAGING_MENU;
>	  else
>		 if IN_FILE_OPEN then
>		    close(INF);
>   	     end if;
>		 if OUT_FILE_OPEN then
>            close(OUTF);
>	     end if;
>		 EXIT;
>	  end if;
>   end loop;
> 
>end IMAGE;

Newsgroups: comp.lang.ada