Why are my attempts to open a file using open for writing failing? Ada 95
        Posted  
        
            by mat_geek
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by mat_geek
        
        
        
        Published on 2010-03-19T02:04:41Z
        Indexed on 
            2010/03/19
            2:11 UTC
        
        
        Read the original article
        Hit count: 494
        
When I attempt to open a file to write to I get an Ada.IO_Exceptions.Name_Error.
The procedure call is Ada.Text_IO.Open
The file name is "C:\CC_TEST_LOG.TXT". This file does not exist.
This is on Windows XP on an NTFS partition. The user has permissions to create and write to the directory. The filename is well under the WIN32 max path length.
 name_2 : String := "C:\CC_TEST_LOG.TXT"
 if name_2'last > name_2'first then
    begin
       Ada.Text_IO.Open(file, Ada.Text_IO.Out_File, name_2);
       Ada.Text_IO.Put_Line(
          "CC_Test_Utils: LogFile: ERROR: Open, File "
          & name_2);
       return;
    exception
       when The_Error : others =>
          Ada.Text_IO.Put_Line(
             "CC_Test_Utils: LogFile: ERROR: Open Failed; "
              & Ada.Exceptions.Exception_Name(The_Error)
              & ", File " & name_2);
    end;
 end if;
        © Stack Overflow or respective owner