INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

PGI visual fortran problem

PGI visual fortran problem

(OP)
Hi.

I was a compaq visual fortran user.Now i'm using the visual studio 2012 and PGI visual fortran 2012. My Windows is 7, 64bit. But i have problem with READ and WRITE commands.
for example a simple code for WRITE:

integer a
open(unit=1, file='aaa.txt',status="new")
read*,a
write(1,*) a

"runtime error: severe 10 :cant overwrite existing file"

and a simple code for READ: (aaa.txt just has one array)

real a
open(unit=1, file='aaa.txt',status="old")
read(1,*)a
print *,a

"runtime error: 24 :end of file during read"

generally, My last codes don't work true in the new environment. what's your idea?
thanks.

RE: PGI visual fortran problem

I think there are a couple of problems with your first listing: 1) You are trying to read from a brand new file (is empty!) and 2) I don't think there is such thing as " read* "...use proper syntax.

As far as the second listing, there isn't much there; the only thing may be that the file is truly empty...maybe it exists and it is there...but are you sure it has something in it? do you have WRITE/READ permissions on it?

RE: PGI visual fortran problem

read * is just reading from the console. I'm guessing the problem is with the unit number. unit 1 is probably reserved for reading from the console. Try changing the unit number to 10 or 100 or something else other than 1.

RE: PGI visual fortran problem

(OP)
As i said i have some codes which don't work true in the visual studio. They are my dissertation codes and i'm sure that input files are not empty. It is just about READ and WRITE.

also, I changed the unit number from 1 to 10 and it has not work correctly yet.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close