comp.lang.ada
 help / color / mirror / Atom feed
From: "rashmi" <rashmi.thoras@gmail.com>
Subject: Status_Error in close() of file
Date: 7 Dec 2005 05:27:06 -0800
Date: 2005-12-07T05:27:06-08:00	[thread overview]
Message-ID: <1133962026.359542.133690@g14g2000cwa.googlegroups.com> (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




             reply	other threads:[~2005-12-07 13:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-07 13:27 rashmi [this message]
2005-12-07 13:50 ` Status_Error in close() of file jimmaureenrogers
replies disabled

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