Writing Fortran unformatted files with VB

  • Thread starter Thread starter Mitch
  • Start date Start date
M

Mitch

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
 
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
 
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
 
Back
Top