how to synchronize output

Hello to All !

I have a java class, that calls native methods through JNI.

This java class use System.out.println() to output debug messages, the native methods use fprintf() to do the same.

unfortunately the output of both is mixed up in my output file.

I expect the follwing:

1. start java app

2. java app prints out a message to console

3. java app calls native method

4. native method prints out a message to the console

5. native method returns

6. java app prints out a message and exits

But I get the following in my console:

2. output from java app

6. output from java app

4. output from native method

What I have to do to bring the output in the right order ?

Greetings, Frank

[787 byte] By [fweiler@kbv.dea] at [2007-11-27 2:35:34]
# 1
After your printfs, call flush() on that stream.Be aware that if this is Windows, then you may have to link a special library - otherwise flish is a noop.
bschauwejavaa at 2007-7-12 2:54:01 > top of Java-index,Java HotSpot Virtual Machine,Specifications...