Read from another process' output stream

后端 未结 2 1865
礼貌的吻别
礼貌的吻别 2021-01-21 21:59

i wanted to read the output-stream of a c-Application in my Java program. iremoted (available here: http://osxbook.com/software/iremoted/download/iremoted.c) is a C-App

2条回答
  •  别那么骄傲
    2021-01-21 22:36

    stdout is buffered and it's not automatically flushed if you are not writing to screen. Add:

    fflush(stdout);
    

    after:

    printf("%#lx %s\n", (UInt32)event.elementCookie,
        (event.value == 0) ? "depressed" : "pressed");
    

提交回复
热议问题