Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29276 Discussions

Permission to access file denied, Windows or Compiler bug?

savrasov
Beginner
1,071 Views
Intel Fortran 11, Windows7, x64: Simple code that producesan errorafter about 3000 times deleting and creating the same file. Does anyone have an idea what's wrong?

do i=1,10000
print*,i
open(1,file='1.dat',status='new',form='unformatted')
write(1)12345
close(1,status='delete')
enddo
end


forrtl: severe (9): permission to access file denied, unit 1, file E:\\1.dat
Image PC Routine Line Source
tmp.exe 004A0DEA Unknown Unknown Unknown
tmp.exe 004169C0 Unknown Unknown Unknown
tmp.exe 00415B9A Unknown Unknown Unknown
tmp.exe 004081FD Unknown Unknown Unknown
tmp.exe 004010CE _MAIN__ 3 Source1.for
tmp.exe 004A77A3 Unknown Unknown Unknown
tmp.exe 0044C8C7 Unknown Unknown Unknown
tmp.exe 0044C79F Unknown Unknown Unknown
kernel32.dll 773C3677 Unknown Unknown Unknown
ntdll.dll 778E9D42 Unknown Unknown Unknown
ntdll.dll 778E9D15 Unknown Unknown Unknown

0 Kudos
2 Replies
Steven_L_Intel1
Employee
1,071 Views
I've seen this before - it's a Windows timing issue. Try adding a call to SLEEPQQ(500) after each close and that should help.
0 Kudos
savrasov
Beginner
1,071 Views
Steve, thanks for the quick response!

Just for the record, I found a different workaround in my context by using STATUS='REPLACE'during file openninginstead of deleting and recreating it.

0 Kudos
Reply