How to redirect fprintf output to C socket?

后端 未结 3 1235
慢半拍i
慢半拍i 2021-01-13 20:17

How can I redirect fprintf output to a socket?

I am editing source code which has a lot of fprintf calls. It logs to a file. But I would li

3条回答
  •  死守一世寂寞
    2021-01-13 20:50

    I realize this isn't your question, but you might consider using a tool like netcat instead of messing with the code (which doesn't seem like a trivial change).

    You can do something like this (updated to use a log fifo):

    mkfifo /path/to/log
    
    nc   < /path/to/log
    

    http://netcat.sourceforge.net/

提交回复
热议问题