Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unbuffered subprocess stdout on windows

Tags:

java

c

windows

Is there an easy way to read output from subprocess unbuffered? I'm trying to call a C program from Java, but apparently it's stdout block-buffered when connected to pipe and line-buffered only when connected to console. I cannot modify C program.

Maybe there is a way to fool the program into thinking it is connected to console? Bonus points for a solution that works on linux as well.

like image 813
Norill Tempest Avatar asked Sep 21 '12 15:09

Norill Tempest


1 Answers

It's not a great solution, but the runtime library probably doesn't buffer serial ports so if you're desperate enough you could use a null-modem emulator such as com0com or a derivative thereof.

like image 140
Harry Johnston Avatar answered Sep 23 '22 16:09

Harry Johnston