Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PGI visual fortran problem

Status
Not open for further replies.

zamani86

Programmer
Jul 9, 2015
2
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.

 
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?

 
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.
 
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top