Arjan <
arjan.v...@rivm.nl> wrote:
> ... How can I make printf and write
> wait for one-another to finish? I know that FLUSH(6) can do something on
> the FORTRAN-side, but what to do on the C-side? Do C and FORTRAN know
> about one another's stdout? Should I follow a different route? Which?
I generally prefer to avoid that kind of problem by doing all the output
for a single file from a single language or the other (usually Fortran
in most of my cases) instead of fighting with trying to coordinate
possibly separate buffers.
I have a small Fortran wrapper routine which does nothing other than
take a character argument and write that argument to the Fortran output
unit (almost always 6, but I do isolate that dependency elsewhere). I
have the C code call that wrapper routine whenever I want it to print
something. I was going to trot out a sample, but I failed to find it in
a quick glance at the first place I thought I should have one saved.
Yes, it does require making changes in the C code, but I don't end up
doing it a lot (apparently little enough to make it slightly hard for me
to find an example in my code readily at hand). If I recall correctly, I
tended to use something like sprintf in C to write to a string to be
passed to my wrapper routine.
--
Richard Maine
email: last name at domain . net
domain: summer-triangle