This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] fix is_open with -mwindows


Manually tested under i686-mingw.
Tested on i686-linux, committed on trunk

On Windows an application linked with -mwindows option
does not have a console attached. In this case there
is no standard files (Current_Output, Current_Error and
Current_Input) created.
A call to Text_IO.Is_Open (Current_Output) should returns
false.
--
The following program should output "closed" into the file
cout.out when run from the standard Windwos cmd.exe shell.
--
with Ada.Exceptions; use Ada.Exceptions;
with Ada.Text_IO;    use Ada.Text_IO;
procedure Cout is
   F : File_Type;
begin
   Create (F, Out_File, "cout.out");
   if Is_Open (Current_Output) then
      Put_Line (F, "open");
   else
      Put_Line (F, "closed");
   end if;
   Close (F);
end Cout;

2007-08-14  Pascal Obry  <obry@adacore.com>

	* s-fileio.adb (Is_Open): Add check for usability of the underlying
	file stream.

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]