当我试图打开一个要写入的文件时,我得到一个错误:Ada.IO_Exceptions.Name_Error。过程调用是Ada.Text_IO.Open;文件名是C:\CC_TEST_LOG.TXT。此文件不存在。
它位于Windows XP上的NTFS分区上。用户具有创建和写入目录的权限。文件名远低于WIN32的最大路径长度。
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;发布于 2010-03-19 16:42:13
如果“文件不存在”,您应该首先Create它,对于example。请注意,“对于文本输入-输出,过程Create、Open和Reset具有A.10.2子句中描述的其他效果。”
如果这与您的previous question相关,则提供更多详细信息可能会有所帮助。
https://stackoverflow.com/questions/2474563
复制相似问题