登 录
註 冊
论坛
微波仿真网
注册
登录论坛可查看更多信息
微波仿真论坛
>
程序
>
g77 及gfrotran 中二进制文件的问题
发帖
回复
2713
阅读
0
回复
[
讨论
]
g77 及gfrotran 中二进制文件的问题
离线
febi
UID :2537
注册:
2007-05-11
登录:
2016-05-05
发帖:
123
等级:
退休版主
0楼
发表于: 2008-03-30 10:14:00
mF*2#]%dx
A question about g77's OPEN & WRITE
Dfg2`l
+ jc!5i .
e:fy#,HEj{
--------------------------------------------------------------------------------
I&}L*Z?`
r`W)0oxD
Zhong Wang wrote:
TC!Yb_H}gN
3!XjtVhK?I
> I am using g77 for programing now. But I found that
=,spvy'"*C
> g77 is somewhat
*W,]>v0%T
> different to Visual Fortran in I/O.
52:HNA\E/
>
l? Udn0F
> In visual fortran, the following code is legal:
8!O5quEc
>
($au:'kU
> REAL a(10)
_=_Px@<Q
> OPEN(10,file='aaa.dat',form='binary')
$HHs ^tW
> WRITE(10)a
l=S 35og
> CLOSE(10)
-JMdE_h
> <<<<<
I`-8Air5f
> You can see that in file aaa.dat there's not
b6nsg|
> anything between the integer
qE&v ;
> and real numbers.
H?<N.Dq
> But in g77, if I use:
Ktb\ b w
>
n0r+A^]
> REAL a(10)
ub^h&=\S
> OPEN(10,file='aaa.dat',form='unformatted')
C7lH]`W|/
> WRITE(10)a
4|buk]9
> CLOSE(10)
PF)jdcX
> <<<<<
^t` k0<
> With "hexedit aaa.dat", you can find there's a
@$S+ Ne[<
> length value before and after
0b+Wc43}K
> each record. You know, sometimes we have to make more
[#-b8Cu
> efforts to deal with
K2M~-S3
> those length values when we use other softwares to
s.bc>E0
> open these data files. For
IHam 4$~-
> example, when I use matlab to open the file, I have to
"& ])lz[u
> read off those length
[ey:e6,T9
> values. It's very convinient.
sqEI4~514
>
RDW8]=uM
> Can you recommend me a possible method with g77 to
_4"mAPt
> generate data file which
l~c@^!
> contains no extra bytes in it? Or can the developers
Dv| #u|iw
> add some new features
q)LMm7
> like form='direct' to g77?
G`SUxhC k
G_;)a]v8)
No, there's no method to get rid of the record lenghts in an unformatted
=XA;[PVx:#
file when using g77. However, if all the records in your file are the
"?]{%-u
same length, you could write a "direct access" file, by doing the writes
>80;8\
thusly:
%<k2#6K
xHL( !PF
REAL A(10)
qkt0**\
OPEN(...,ACCESS='DIRECT',RECL=....)
77C'*tt1]
DO I = 1, N
xSktg]u Se
... fill A
e@Fo^#ImDx
..
wQqb`l7+
&+Z,hs9%
未注册仅能浏览
部分内容
,查看
全部内容及附件
请先
登录
或
注册
共
条评分
磁砖
发帖
回复