How to capture output of printf?

后端 未结 4 1847
不思量自难忘°
不思量自难忘° 2020-12-29 14:49

I am calling a function funcB from funcA. funcB uses several printf statements to output data. Is there a way for me to c

4条回答
  •  没有蜡笔的小新
    2020-12-29 15:05

    If nothing else in your program uses printf, you can write your own version and link it explicitly. The linker will not look in the standard library if the function is already defined. You can probably use vsprintf for the implementation, or some safer version with overrun checking if it is supplied by your compiler.

提交回复
热议问题