Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个程序写入 mkfifo,每 3 秒使用printf(). 我正在尝试cat /path/to/device在另一个终端窗口中阅读它。但不是每 3 秒更新一次,而是每 25 秒打印一次。为什么?如何让它更新更快?(乌班图威利)
printf()
cat /path/to/device
管道的一端或两端缓冲超出您的要求。在你的写作程序中,fflush当你写完你的 7 行,并用cat -u(如果你cat不是 GNU cat)读取输出。
fflush
cat -u
cat