- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is there possibility to disable files fort.xxx created when program writes to unit which is not opened by OPEN statement and generate error instead?
My code sometimes generates these files and I cannot find when and why it happens.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Compile your program with /traceback. Before running it, set the environment variable FORTn (where n is the unit number) to something like "/path/that/does/not/exist". Run your program. Inspect the traceback. Fix your program. Profit!
[plain]>type preconnected.f90
PROGRAM preconnected
WRITE (77, "('Hello world')")
END PROGRAM preconnected
>ifort /traceback preconnected.f90
Intel(R) Visual Fortran Compiler XE for applications running on IA-32, Version 14.0.0.050 Beta Build 20130417
Copyright (C) 1985-2013 Intel Corporation. All rights reserved.
Microsoft (R) Incremental Linker Version 10.00.40219.01
Copyright (C) Microsoft Corporation. All rights reserved.
-out:preconnected.exe
-subsystem:console
-incremental:no
preconnected.obj
>set FORT77=path\that\does\not\exist
>preconnected.exe
forrtl: severe (29): file not found, unit 77, file U:\procrastination\path\that\does\not\exist
Image PC Routine Line Source
preconnected.exe 0113105E _MAIN__ 2 preconnected.f90
preconnected.exe 0117A772 Unknown Unknown Unknown
preconnected.exe 01165AB4 Unknown Unknown Unknown
kernel32.dll 768ED2E9 Unknown Unknown Unknown
ntdll.dll 774E1603 Unknown Unknown Unknown
ntdll.dll 774E15D6 Unknown Unknown Unknown
[/plain]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Since you know what the unit numbers are, try adding code at the start of the program to open a file for read-only. This will occupy the unit number, then later in the run of the program, the write will fail. Hopefully you can locate the offending statemtents.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Many thanks for responses I hope both help me very much.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
IanH, good suggestion, much better (and less effort) than mine.
Since these files apparently written, setting the attribute Read Only might also locate the problem statement (though this may not prevent reads).
Jim Dempsey

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page