 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
christyleomin
Joined: 08 Apr 2011 Posts: 155
|
Posted: Mon Jun 03, 2013 10:54 am Post subject: Understanding this syntax |
|
|
Please can anyone advise what does the syntax mean?
Code: | read(unit=line,fmt="(I8,3E16.0)") node,xcoor,ycoor,zcoor |
What does fmt=="(I8,3E16.0)") signify? |
|
Back to top |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2615 Location: Sydney
|
Posted: Tue Jun 04, 2013 1:35 am Post subject: |
|
|
Code:
read(unit=line,fmt="(I8,3E16.0)") node,xcoor,ycoor,zcoor
This is an "internal" read from a character variable "line", rather than from an external file.
Line should be declared as something like: CHARACTER LINE*100
fmt="(I8,3E16.0)" defines the format statement for reading the 4 variables, being an integer in 8 characters and 3 reals of 16 characters.
With FTN95, and probably most other compilers, you can use a comma to terminate each field, so that the following would be read correctly.
101,2., 3.,5.
"node,xcoor,ycoor,zcoor" is the variable list for the read, being in this case a node number and coordinates.
I note there is no IOSTAT= option. When reading, this should be included to manage and errors when interpreting the information in LINE. You should consider including IOSTAT=ii, and test if (II/=0) ... to recover in the event of an error in the input data.
Typically, LINE would have been previously read from the data file and then tested to see what sort of information it is, typically being a data line, termination line, comment line or a command line for the start of a new data element.
This READ statement expects all information to be in the first 56 characters of LINE. There is no allowance for the input information to be over two "lines", as might be the case if "fmt=*" |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|