쓰기 실패를 위해 Open을 사용하여 파일을 열려고 시도하는 이유는 무엇입니까? ADA 95

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

  •  21-09-2019
  •  | 
  •  

문제

쓸 파일을 열려고 할 때 ada.io_exceptions.name_error를 얻습니다.

절차 호출입니다 ada.text_io.open

파일 이름은 "c : cc_test_log.txt"입니다. 이 파일은 존재하지 않습니다.

이것은 NTFS 파티션의 Windows XP에 있습니다. 사용자는 디렉토리를 작성하고 쓸 권한이 있습니다. 파일 이름은 Win32 Max 경로 길이 아래에 있습니다.

 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;
도움이 되었습니까?

해결책

"파일이 존재하지 않는 경우" Create 먼저.

이것이 당신과 관련이 있다면 이전 질문, 더 자세한 내용을 제공하는 데 도움이 될 수 있습니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top