comp.lang.ada
 help / color / mirror / Atom feed
From: "jimmaureenrogers@worldnet.att.net" <jimmaureenrogers@worldnet.att.net>
Subject: Re: Status_Error in close() of file
Date: 7 Dec 2005 05:50:09 -0800
Date: 2005-12-07T05:50:09-08:00	[thread overview]
Message-ID: <1133963409.624983.214090@g14g2000cwa.googlegroups.com> (raw)
In-Reply-To: 1133962026.359542.133690@g14g2000cwa.googlegroups.com

rashmi wrote:
> 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;
>

How is RE_RcdFil.PV_Fillty set when FUNC_OpClFile is called with a
value of EN_IsCd?

You apparently believe that it retains its value from the open call.
That cannot be true.

Your close procedure will work properly when you pass in a file_type
variable with a valid value.

Jim Rogers




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

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

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