Home > Blockchain >  Scanf not reading piped input's first value only as expected (reads as string, expected integer
Scanf not reading piped input's first value only as expected (reads as string, expected integer

Time:02-05

I would consider myself fairly proficient in C and have been coding in it extensively for a few years now, but during a tutoring session with another student I got stumped on a problem. We are printing Linux device events in one program than trying to read and interpret the data by piping the input of that program into another. I'm hoping I am overlooking something dumb and that you guys can figure it out.

First program's relevant code:

struct input_event event1;
...
// open correct event file and read its values into the input event struct
... 
printf("%d  %zu.%-6zu  %d  =             
  • Related