I have a python script that interfaces with some network pool to read data from, that is continuously 320 bits. This 320 bits should be forward to some C app, that continuously reads these 320 bits from the python script and places them into an int array[8]. To be honest, I have no idea whether this is possible at all and would be thankful for a starting point for this issue.
I tried to incooperate some of your ideas, trying to send data via stdin from python to the C app:
test.exe:
#include <stdio.h>
int main(void)
{
int ch;
/* read character by character from stdin */
do {
ch = fgetc(stdin);
putchar(ch);
} while (ch != EOF);
return 0;
}
test.py:
def run(self):
while True:
payload = 'some data'
sys.stdout.write(payload)
time.sleep(5)
Then I start this whole thing using a pipe: python test.py | test.exe
Unfortunately, there is no data that is received on the test.exe side, shouldn't this data ba available on stdin?
sys.stdout.flush()before sleep