Perché i miei tentativi di aprire un file utilizzando aperto per la scrittura fallendo? Ada 95

StackOverflow https://stackoverflow.com/questions/2474563

  •  21-09-2019
  •  | 
  •  

Domanda

Quando si tenta di aprire un file di scrivere a ottengo un Ada.IO_Exceptions.Name_Error.

La chiamata di procedura è Ada.Text_IO.Open

Il nome del file è "C: \ CC_TEST_LOG.TXT". Questo file non esiste.

Questo è il Windows XP in una partizione NTFS. L'utente dispone di autorizzazioni per creare e scrivere nella directory. Il nome del file è ben al di sotto della lunghezza massima WIN32 percorso.

 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;
È stato utile?

Soluzione

Se il "file non esiste," si dovrebbe Create prima.

Se questo è legato alla tua domanda precedente , essa può contribuire a fornire ulteriori dettagli.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top