tags:

views:

35

answers:

1

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;
+2  A: 

If the "file does not exist," you should Create it first.

If this is related to your previous question, it may help to provide more details.

trashgod
This, was the original problem I was having. I found no answers to it on the web, or in the books. So I asked it here for others reference.
mat_geek
I think I understand. Are you able to `Create` the file now?
trashgod