I’m an absolute beginner with Unix programming, I’ve to make a program that reads from the standard input some commands and then another program that execute those commands. I’ve to use a fifo in order to establish a communication between those two program.
My problem is: how can I make possible reading line by line (one command) from a fifo where those line doesn’t have a fixed size ? I was thinking to implement with signal a sort of synchronization, however I’m sure there are better ways.
I’m sorry if it’s a banal question, but I’m a perfect newbie with this things.
Oh and sorry if my English is bad.
I assume you were reading with
read()? Just usefgets()and let the stdlib handle the buffering. If you usedopen()rather thanfopen()then get your FILE structure withfdopen()first. Something like: