안녕하세요 저는 Visual Studio 2012 아래에서 컴파일하는 매우 간단한 테스트 사례를 가지고 있습니다. 그러나 런타임 오류가 발생합니다. 이 오류를 생성하는 행은 시간 기능과 관련된 예제가 많이있는 cppreference.com에있는 것과 똑같이 복사됩니다. 그냥이 http://en.cppreference.com/w/cpp/chrono/c/localtimestd :: put_time() 문제
#include <fstream>
#include <iomanip>
#include <time.h>
#include <stdio.h>
#include <chrono>
#include <string>
using namespace std;
ofstream & GetTimeStr(ofstream & ofs)
{
time_t rawTime = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
// fails on this line, very deep inside the runtime code.
ofs << std::put_time(std::localtime(&rawTime), "%c %Z");
return ofs;
}
int main()
{
std::ofstream ofs;
ofs.open("Logger.txt");
if (ofs.good())
{
ofs << "some text " << GetTimeStr(ofs) << " more text ";
}
}
같은 예와 페이지 내가이에 의해 촉발되고있는 VC 런타임 버그가 있음을 추측하고있어 여기 http://ideone.com/WaeQcf
어떻게 실패했는지에 대해 더 자세히 설명해 주시겠습니까? 예 : 오류 메시지, 예외, 스택 추적? –
ConsoleApplication6.exe에서 Microsoft Visual Studio C 런타임 라이브러리에서 치명적인 오류가 발생했습니다. 창 팝업이 나타납니다. 프로그램을 디버깅하려면 디버그를 누르고 프로그램을 종료하려면 계속 누르십시오. – EddieV223
게시물에 스택 추적 링크가 추가되었습니다. – EddieV223