473,405 Members | 2,167 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Writing Fortran unformatted files with VB

Hi all,

I hope this is the right place for this post, apologies if it is not.

I am trying to write a program that creates an input file for a dispersion
model. The model is expecting a Fortran "unformatted" binary file in
big-endian. However, my program is written in dotnet and I'd like to avoid
writing and then calling a Fortran program to do this one task. My question
is:

* Is there a way to write a file that looks exactly like an unformatted one
that Fortran 95 would write?

I've been going down the BinaryWriter( with BigEndianUnicode ) path, and I
feel I am close, but the Hex dumps of the two files (mine and a 'proper'
one) look a little different.

Could someone please let me know if what I'm trying to do is possible and
point me in the right direction or tell me I'm wasting my time.

Thanks in advance,

Mitch
Jul 21 '05 #1
2 2159
There is no reason why you should not be able to write the file you want in
..NET. It may require that you create a small set of classes that convert a
set of values into a format that Fortran can read, but there is nothing
preventing this from working.

Your biggest problem may be that the Fortran compiler is expecting a
particular binary encoding for real numbers. The could require some rather
detailed conversion classes.

I'm not much help there, I'm afraid.
--- Nick

"Mitch @pae.net.au>" <mitchell.farquhar_no_spam> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hi all,

I hope this is the right place for this post, apologies if it is not.

I am trying to write a program that creates an input file for a dispersion
model. The model is expecting a Fortran "unformatted" binary file in
big-endian. However, my program is written in dotnet and I'd like to avoid
writing and then calling a Fortran program to do this one task. My question is:

* Is there a way to write a file that looks exactly like an unformatted one that Fortran 95 would write?

I've been going down the BinaryWriter( with BigEndianUnicode ) path, and I
feel I am close, but the Hex dumps of the two files (mine and a 'proper'
one) look a little different.

Could someone please let me know if what I'm trying to do is possible and
point me in the right direction or tell me I'm wasting my time.

Thanks in advance,

Mitch

Jul 21 '05 #2
Thanks Nick,

I'm doing as you suggested writing the small set of classes. The encodig for
a real number may be a pain, but we'll see how I go.

Thanks again,

Mitch

"Nick Malik" <ni*******@hotmail.nospam.com> wrote in message
news:YDRKc.119105$%_6.107468@attbi_s01...
There is no reason why you should not be able to write the file you want in .NET. It may require that you create a small set of classes that convert a set of values into a format that Fortran can read, but there is nothing
preventing this from working.

Your biggest problem may be that the Fortran compiler is expecting a
particular binary encoding for real numbers. The could require some rather
detailed conversion classes.

I'm not much help there, I'm afraid.
--- Nick

"Mitch @pae.net.au>" <mitchell.farquhar_no_spam> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hi all,

I hope this is the right place for this post, apologies if it is not.

I am trying to write a program that creates an input file for a dispersion model. The model is expecting a Fortran "unformatted" binary file in
big-endian. However, my program is written in dotnet and I'd like to avoid writing and then calling a Fortran program to do this one task. My

question
is:

* Is there a way to write a file that looks exactly like an unformatted

one
that Fortran 95 would write?

I've been going down the BinaryWriter( with BigEndianUnicode ) path, and I feel I am close, but the Hex dumps of the two files (mine and a 'proper'
one) look a little different.

Could someone please let me know if what I'm trying to do is possible and point me in the right direction or tell me I'm wasting my time.

Thanks in advance,

Mitch


Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Markus Faust | last post by:
Hi, I'm trying to link Fortran files generated with “Compaq Visual Fortran Optimizing Compiler Version 6.6 (Update B)” under “Enthought Edition build 1028, Python 2.3 (#46, Aug 11 2003,...
13
by: NM | last post by:
Sometimes ago I was having a problem in linking between C++ and Fortran program. That was solved (using input from this newsgroup) using the Fortran keyword "sequence" with the derived types (to...
2
by: Mitch | last post by:
Hi all, I hope this is the right place for this post, apologies if it is not. I am trying to write a program that creates an input file for a dispersion model. The model is expecting a Fortran...
21
by: Cottonwood | last post by:
I want to call a C module from a Fortran program. Whatever I tried - the linker could not find the C module. I know about the leading underscore and switched even that off. I abstracted everything...
3
by: unexpected | last post by:
Hi all, I'm currently working on a large, legacy Fortran application. I would like to start new development in Python (as it is mainly I/O related). In order to do so, however, the whole project...
10
by: Tyler | last post by:
Hello All: After trying to find an open source alternative to Matlab (or IDL), I am currently getting acquainted with Python and, in particular SciPy, NumPy, and Matplotlib. While I await the...
19
by: Gerry Ford | last post by:
I've been pecking away at writing a program that will calculate the inner product of two double-width four-vectors. Larry thinks I'm well started with the following source to populate a vector:...
20
by: Marin Brkic | last post by:
Hello all, please, let me apologize in advance. English is not my first language (not even my second one), so excuse any errors with which I'm about to embarass myself in front of the general...
3
by: john | last post by:
I wrapped some fortran code using F2PY and need to be able to catch fortran runtime errors to run the following: # "grid" is a wrapped fortran module # no runtime errors incurred when run with...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.