I suspect the issue is that you are not checking the return values of fopen or fgets. If fopen fails it will return NULL and if fgets fails it will also return NULL. There is no guarantee that there the msgbuf will contain anything sensible if fgets fails.
If I understand what you are trying to do, I would read from the FIFO using a std::filestream and read the lines using std::getline
And rather than putting the data into std::stringstream, consider using a container like std::vector or std:deque
I suspect there is nothing wrong with the implementation of fgets, there would be a lot of issues if there was.
If I understand what you are trying to do, I would read from the FIFO using a std::filestream and read the lines using std::getline
And rather than putting the data into std::stringstream, consider using a container like std::vector or std:deque
I suspect there is nothing wrong with the implementation of fgets, there would be a lot of issues if there was.
Statistics: Posted by AndyD — Sun Feb 11, 2024 2:05 am