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.
我正在使用taglib 1.6.3的 c 绑定。使用 打开文件时taglib_file_new,消息会打印到 stderr。如何控制和使用这些消息?特别是,我想捕获并处理一些错误,其次我想关闭到 stderr 的详细日志记录。
taglib_file_new
不幸的是,您无法捕获它们,但如果您在发布模式 ( cmake -DCMAKE_BUILD_TYPE=Release) 下编译 TagLib,则不会打印消息。
cmake -DCMAKE_BUILD_TYPE=Release
reopen您可以通过:ing有效地隐藏错误消息stderr。如果您想完全静音,您可以将其重定向到某种空设备或内部日志文件。否则,我想您需要将它们过滤掉。
reopen
stderr
另一种方法是修改 taglib 本身,它应该在提供源代码时工作。