JNI system.out and printf behaviour

前端 未结 1 2077
既然无缘
既然无缘 2021-01-18 01:23

I am writing a program that uses JNI to interface with a simple c program. I have created the following programs:

public static void main(String[] args) {
           


        
相关标签:
1条回答
  • 2021-01-18 01:32

    Yes. You will need to call flush.

    In C, that is the fflush call -

    printf("Hello JNI\n");
    fflush(stdout);
    return 10;
    

    In Java, that is just flush on the Stream -

    System.out.println("before");
    System.out.flush();
    
    0 讨论(0)
提交回复
热议问题