comp.lang.ada
 help / color / mirror / Atom feed
* Status_Error in close() of file
@ 2005-12-07 13:27 rashmi
  2005-12-07 13:50 ` jimmaureenrogers
  0 siblings, 1 reply; 2+ messages in thread
From: rashmi @ 2005-12-07 13:27 UTC (permalink / raw)


Dear reader

When using the function FUNC_OpClFile() below I have been getting a
Status_Error after all my data was read from the file "OJV.dat" . Using
the debugger I located this error at the place where "OJV.dat" was
asked to be closed by the close() function. As I suspected that the
problem was because the close() function could not locate the
End-of-File marker, I even wrote another function FUNC_CanCloFi to seek
and return the End-of-File marker where found, so that close() could
work. But the same Status_Error message still persists. So I am trying
to figure out where and why the problem is exactly happening.

Rashmi.

*******************************************************************************
function FUNC_OpClFile(EN_Cald : in EN_FnCd) return EN_Acpt is
        type RE_FilRcd is
        record
        	PV_FilIMo : File_Mode := In_File ;
        	PV_FilIty : File_Type;
        end record;
        TF_CanClo : Boolean;
        RE_RcdFil : RE_FilRcd;
        EN_OCFRtn : EN_Acpt := EN_IsOk;
        ST_IFiNam : String  := ".\OJV.dat";
begin
	case EN_Cald is
    	     when EN_NtCd =>
                               open
(RE_RcdFil.PV_FilIty,RE_RcdFil.PV_FilIMo,ST_IFiNam);
                               set_input(RE_RcdFil.PV_FilIty);
	     when EN_IsCd =>
		TF_CanClo := FUNC_CanCloFi;
		if TF_CanClo then
	                         close(RE_RcdFil.PV_FilIty);
	                end if;
	    when others  =>
                                  Null;
	 end case;
	return EN_OCFRtn;
end FUNC_OpClFile;

function FUNC_CanCloFi return Boolean is
	TF_NxtEof : Boolean := False;
	CH_Dumy : Character;
begin
	while not TF_NxtEof
	loop
	      if not End_of_File then
	               Get_Immediate(CH_Dumy);
	      end if;
	      if End_of_File then
	           TF_NxtEof := True;
	      end if;
	 end loop;
	return TF_NxtEof ;
end FUNC_CanCloFi;
*******************************************************************************
OJV.dat

8
1  8
2  0
3  0
4  0
1  4  1
2  5  1
3  3  1
4  2  1
5  6  1
6  5  1
7  3  1
8  3  1
1  -1.5  +9.0
2  -1.0  +5.4
3  +2.3  +3.0
4  +1.1  +2.1
5  +1.2  +1.4
6  +2.4  +2.9
7  -2.1  +8.7
8  -2.3  +5.6




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

end of thread, other threads:[~2005-12-07 13:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-07 13:27 Status_Error in close() of file rashmi
2005-12-07 13:50 ` jimmaureenrogers

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