a C .exe doesn't read writeToStdin
Please help:
At first I thought QProcess is wrong now by putting in the wroteToStdin signal I determined my .exe written in C doesn't read the stdin.
This is the code:
Code:
fgets(serialnmr,sizeof(serialnmr),stdin);
serialnmr is char * and scanf nor gets works :(
Re: a C .exe doesn't read writeToStdin
Remember that you need a newline when reading using scanf() or gets().
Re: a C .exe doesn't read writeToStdin
just to make sure I understand:
for using scanf() and gets() the writeToStdin must be:
Code:
proc->writeToStdin("tester\n");
because my code in my QT side is:
Code:
proc->writeToStdin("tester\n");
but I use it with:
Code:
fgets(serialnmr,sizeof(serialnmr),stdin);
and another thing I see is that nothing is displayed using readFromStdout until the program (my.exe) has exited.
I'm really in a bind please help!
Re: a C .exe doesn't read writeToStdin
[QUOTE=Shlainn;20118]but I use it with:
Code:
fgets(serialnmr,sizeof(serialnmr),stdin);
It doesn't matter. You still need the newline to flush the stdin buffer of your application.
Quote:
and another thing I see is that nothing is displayed using readFromStdout until the program (my.exe) has exited.
Maybe you are missing newlines here, too... In the output buffer this time. You can use fflush() instead of the newline to force the flush too.