由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - How to read binary(data) file generated by Fortran in C/C++ (转载)
相关主题
请教C++How to generate .dll files from a .c file using VC6.0?
一个C++的概念问题what's .gch file? (g++)
多线程编程前景如何?Solution suggestions? (转载)
CODING QUESTIONShow to read log files on a remote server with ssh?
java可以直接去读txt file里指定的一行吗?来几个C++测试题
C++ 普及课程 (视频):Introduction of STLAn empty C structure Question
generate unique integer ID from columns in SQL table (转载multiple random number generator
问一道面试题question for C++ constant
相关话题的讨论汇总
话题: c++话题: fortran话题: file话题: binary话题: generated
进入Programming版参与讨论
1 (共1页)
M**********n
发帖数: 432
1
【 以下文字转载自 Computation 讨论区 】
发信人: ManshengChen (像琼瑶一样老去), 信区: Computation
标 题: How to read binary(data) file generated by Fortran in C/C++?
发信站: BBS 未名空间站 (Sat Oct 13 19:28:21 2007)
How to read binary(data) file generated by Fortran in C/C++?
Is it possible? If possible how to realize it?
The binary file generated by Fortran is a double precision data file.
I have tried to use read binary file in C++, but have problem. The following
is my C++
code.
double temp=0.0;
ifstream File("bin.data",i
P********e
发帖数: 2610
2
c++的 double size可能和Fortran不一样
and be aware of header

following

【在 M**********n 的大作中提到】
: 【 以下文字转载自 Computation 讨论区 】
: 发信人: ManshengChen (像琼瑶一样老去), 信区: Computation
: 标 题: How to read binary(data) file generated by Fortran in C/C++?
: 发信站: BBS 未名空间站 (Sat Oct 13 19:28:21 2007)
: How to read binary(data) file generated by Fortran in C/C++?
: Is it possible? If possible how to realize it?
: The binary file generated by Fortran is a double precision data file.
: I have tried to use read binary file in C++, but have problem. The following
: is my C++
: code.

q****2
发帖数: 7
3
Two links
http://cires.colorado.edu/~knowlesk/programming/fortranio.html
http://local.wasp.uwa.edu.au/~pbourke/dataformats/fortran/

following

【在 M**********n 的大作中提到】
: 【 以下文字转载自 Computation 讨论区 】
: 发信人: ManshengChen (像琼瑶一样老去), 信区: Computation
: 标 题: How to read binary(data) file generated by Fortran in C/C++?
: 发信站: BBS 未名空间站 (Sat Oct 13 19:28:21 2007)
: How to read binary(data) file generated by Fortran in C/C++?
: Is it possible? If possible how to realize it?
: The binary file generated by Fortran is a double precision data file.
: I have tried to use read binary file in C++, but have problem. The following
: is my C++
: code.

e**e
发帖数: 3
4
Did the Fortran program use "direct access" or "sequential access" to
write the binary file?
If "sequential access", each write statement will produce one record
in the data file, and the record is prefixed and postfixed with the
integer value that is the length of that record. For example
open(unit=..., file="...", access="sequential", form="unformatted")
write(unit=...)1.23d0
will write the four-byte integer "8", the eight-byte double "1.23d0",
and again the four-byte integer "8". The "8

【在 M**********n 的大作中提到】
: 【 以下文字转载自 Computation 讨论区 】
: 发信人: ManshengChen (像琼瑶一样老去), 信区: Computation
: 标 题: How to read binary(data) file generated by Fortran in C/C++?
: 发信站: BBS 未名空间站 (Sat Oct 13 19:28:21 2007)
: How to read binary(data) file generated by Fortran in C/C++?
: Is it possible? If possible how to realize it?
: The binary file generated by Fortran is a double precision data file.
: I have tried to use read binary file in C++, but have problem. The following
: is my C++
: code.

M**********n
发帖数: 432
5
This works.
Thank you very much!

【在 e**e 的大作中提到】
: Did the Fortran program use "direct access" or "sequential access" to
: write the binary file?
: If "sequential access", each write statement will produce one record
: in the data file, and the record is prefixed and postfixed with the
: integer value that is the length of that record. For example
: open(unit=..., file="...", access="sequential", form="unformatted")
: write(unit=...)1.23d0
: will write the four-byte integer "8", the eight-byte double "1.23d0",
: and again the four-byte integer "8". The "8

1 (共1页)
进入Programming版参与讨论
相关主题
question for C++ constantjava可以直接去读txt file里指定的一行吗?
any lexer/parser enthusiasts here?C++ 普及课程 (视频):Introduction of STL
[合集] 请教一个大公司的笔试题,关于c++随机数的generate unique integer ID from columns in SQL table (转载
Random number generator in C++问一道面试题
请教C++How to generate .dll files from a .c file using VC6.0?
一个C++的概念问题what's .gch file? (g++)
多线程编程前景如何?Solution suggestions? (转载)
CODING QUESTIONShow to read log files on a remote server with ssh?
相关话题的讨论汇总
话题: c++话题: fortran话题: file话题: binary话题: generated