- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Recently I migrated from Win XP to Win 7. As part of my work, I use fortran based EXE to perform calculations. Where, it creates a new directory and dumps the output in several files there. With Win 7, I get the error "forrtl: severe (157): Program Exception - access violation" when the EXE tend to create the files within the directory it created.
I tried running the executable in command prompt "as administrator", even then it throws the same error. When I checked the properties of new directory created by the EXE, Read-Only option is partially enabled with comment (only applies to file in folder).
Can anyone help me fixing this issue?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You should avoid creating directories and files outside user owned file space (e.g. avoid the directories where the compiler is installed). Windows 7 rightly stops you from doing things which XP didn't care about.
In user owned space, if you have lost permissions, you whould be able to fix them in Windows Explorer (right click on directory, choose properties, then security tab, and set permissions for your user name.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Fortran does not have "directory" as a known entity independent of operating systems. A simple fix is for you to create the directory using OS commands or GUI tools before running the EXE, then to run the EXE.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think the directory protection is a red herring, and that you misunderstand the term "access violation" in this context. Please read Don't Touch Me There - What error 157 (Access Violation) is trying to tell you for more information. I recommend running the program under the debugger and seeing where exactly in the program it is failing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@ Tim - I confirmed the full control over the directory. Still the problem exist.
@ mecej4 - My code creates the directory using SYSTEM (....) function and it works good. Issue is, it couldn't create any file within the newly created directory.
@ Steve - Thank you for the post. Now I understand error "157" better. Will debug and try to locate the error and see what improvement I can make.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've seen this too where when the created directory is located in the root system folder (C:\) that the attributes are "funny" (often hidden and read only).
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