떨어져 libavformat 오류 메시지를 설정할 수 있습니다, libavformat 체감, stderr
에 오류 메시지를 기록? 또는 더 나은 아직 파이프, 내 자신의 산뜻한 로깅 기능?가 어떻게 기본적으로
편집 : 다른 로깅 목적으로 필요하기 때문에 stderr를 다른 곳으로 리디렉션 할 수 없습니다. 단지 libavformat에 쓰기를 원하지 않습니다.
이#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ofstream file("file.txt");
streambuf *old_cerr = cerr.rdbuf();
cerr.rdbuf (file.rdbuf());
cerr << "test test test" << endl; // writes to file.txt
// ...
cerr.rdbuf (old_cerr); // restore orginal cerr
return 0;
}
편집 : 질문을 편집, 내가 위의 코드에 대해 경고 후이 모든 cerr
항목을 리디렉션합니다 당신은 사용자 정의 파일로 리디렉션 할 수
http://stackoverflow.com/questions/5095839/redirect-from-stderr-to-another-file-descriptor 또는 http://stackoverflow.com/questions/573724/how-can-i-redirect를 참조하십시오. -stdout-to-some-visible-in-a-windows-applications –
프로그램의 stderr 전체 출력을 리디렉션하고 싶지 않습니다. 로깅 기능을 깔끔하게 포맷 된 방식으로 작성했습니다. 나는 libavformat에 쓰기를 원치 않는다. – amrhassan
정확히 stderr에 무엇을 씁니까? 이것은 libavcodec 라이브러리가 stderr로 에러를 보내는 것을 처음 들었을 때입니다 (이 라이브러리에 대한 나의 경험은 크지 않습니다). –