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

  • Context: Fortran 
  • Thread starter Thread starter ydonna1990
  • Start date Start date
  • Tags Tags
    Fortran
Click For Summary

Discussion Overview

The discussion revolves around the Fortran programming language, specifically focusing on the meaning of the "iostat=stat" argument and the "buf argument" in the context of file operations and subroutines. Participants are seeking clarification on these terms as they relate to different versions of Fortran.

Discussion Character

  • Exploratory
  • Technical explanation
  • Homework-related

Main Points Raised

  • Some participants inquire about the meaning of "iostat=stat" in Fortran, indicating a need for clarification on its function in file operations.
  • There is a repeated question regarding the "buf argument," with participants expressing confusion about its definition and usage.
  • One participant provides a code snippet to illustrate their question about "iostat=stat" but does not clarify the "buf argument." They also mention a conditional statement related to file reading.
  • Another participant notes that the '::' syntax appears to be from Fortran 90 or later, indicating a lack of familiarity with these versions compared to Fortran 77.
  • There is acknowledgment of different experiences with Fortran versions, with some participants suggesting that others may be better suited to answer questions about newer syntax.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the definitions of "iostat=stat" and "buf argument," and multiple viewpoints regarding familiarity with different Fortran versions are expressed. The discussion remains unresolved.

Contextual Notes

Participants express uncertainty about the "buf argument" and its context, indicating that there may be missing examples or definitions that could clarify its usage. There is also a noted dependence on the version of Fortran being discussed, which may affect understanding.

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 ·
Replies
2
Views
1K
  • · Replies 17 ·
Replies
17
Views
7K
  • · Replies 20 ·
Replies
20
Views
4K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 37 ·
2
Replies
37
Views
5K
  • · Replies 4 ·
Replies
4
Views
8K
  • · Replies 17 ·
Replies
17
Views
6K
  • · Replies 75 ·
3
Replies
75
Views
18K
  • · Replies 9 ·
Replies
9
Views
2K