Fortran Fortran Beginner: What is iostat=stat & buf Argument?

  • Thread starter Thread starter ydonna1990
  • Start date Start date
  • Tags Tags
    Fortran
AI Thread Summary
The discussion centers around the Fortran programming language, specifically the use of the "iostat" and "buf" arguments. The "iostat" argument is used in file operations to capture the status of the operation, indicating whether it was successful or if an error occurred. A value of zero for "iostat" indicates success. The "buf" argument, although mentioned, is not clearly defined in the context provided, leading to confusion among participants. The conversation references a Fortran code example where "iostat" is utilized in file reading operations, and there is a note that the syntax using "::" is characteristic of Fortran 90 or later versions, which some participants are less familiar with. Overall, the thread highlights the need for clarity on the "buf" argument and the differences in Fortran versions.
ydonna1990
Messages
15
Reaction score
0
Hello. I am a beginner in the Fortran language and I want to know what isotat=stat means.

also what is exactly the "buf argument"?
 
Technology news on Phys.org
ydonna1990 said:
I want to know what isotat=stat means

A Google search for "fortran iostat" gave me this page as the first result:

http://www.cs.mtu.edu/~shene/COURSES/cs201/NOTES/chap04/iostatus.html

ydonna1990 said:
what is exactly the "buf argument"?

I don't know what you're asking about here. It might help if you can show us an example.
 
jtbell said:
A Google search for "fortran iostat" gave me this page as the first result:

http://www.cs.mtu.edu/~shene/COURSES/cs201/NOTES/chap04/iostatus.html
I don't know what you're asking about here. It might help if you can show us an example.

Thanks for the reply.

if (userdefine==0) then

open(100,file='COORD.DAT',iostat=stat)
if(stat==0)then
read(100,'(a)',iostat=stat)line
read(100,'(a)',iostat=stat)line
if ((line(1:2)/='--').and.(line/=' ').and.(line(1:5)/='COORD'))then
 
ydonna1990 said:
if (userdefine==0) then

open(100,file='COORD.DAT',iostat=stat)
if(stat==0)then
read(100,'(a)',iostat=stat)line
read(100,'(a)',iostat=stat)line
if ((line(1:2)/='--').and.(line/=' ').and.(line(1:5)/='COORD'))then

Where is the "buf argument"? That's what I was asking about.
 
jtbell said:
Where is the "buf argument"? That's what I was asking about.

SUBROUTINE ConProdOpt(Iphi_in,Ilnkx_in,Ilnky_in,Ilnkz_in,FirstRun_in,Neindx_in)
IMPLICIT NONE
INTEGER,buf ::Iphi_in,Ilnkx_in,Ilnky_in,Ilnkz_in,FirstRun_in

I saw it everywhere earlier but for some reason I can't find it and now I can only find this one.
 
ydonna1990 said:
INTEGER,buf ::Iphi_in,Ilnkx_in,Ilnky_in,Ilnkz_in,FirstRun_in

The '::' looks like Fortran 90 (or later). I'm not very familiar with those versions of Fortran, so someone else had best answer this part of your question.

iostat was used in Fortran 77 (possibly earlier) which is what I'm familiar with.
 
jtbell said:
The '::' looks like Fortran 90 (or later). I'm not very familiar with those versions of Fortran, so someone else had best answer this part of your question.

iostat was used in Fortran 77 (possibly earlier) which is what I'm familiar with.

Ah ok. Thanks anyway
 

Similar threads

Replies
2
Views
1K
Replies
17
Views
6K
Replies
20
Views
4K
Replies
8
Views
1K
Replies
4
Views
2K
Replies
17
Views
6K
Replies
75
Views
17K
Back
Top