나는 파일에 데이터를 저장하는 프로그램을 가지고 있고 그 로그에 현재 날짜/시간의 타임 스탬프를 넣고 싶지만 파일에 시간을 쓰려고 할 때 그것은 나타나지 않지만 다른 데이터는 내가 쓰는 의지.파일에 시간을 절약하려면 어떻게해야합니까?
#include <iostream>
#include <windows.h>
#include <fstream>
#include <string>
#include <sstream>
#include <direct.h>
#include <stdio.h>
#include <time.h>
using namespace std;
string header_str = ("NULL");
int main()
{
for(;;)
{
stringstream header(stringstream::in | stringstream::out);
header << "datasdasdasd_";
time_t rawtime;
time (&rawtime);
header << ctime (&rawtime);
header_str = header.str();
fstream filestr;
filestr.open ("C:\\test.txt", fstream::in | fstream::out | fstream::app | ios_base::binary | ios_base::out);
for(;;)
{
filestr << (header_str);
}
filestr.close();
}
return 0;
}
누구나이 문제를 해결하는 방법을 알고 계십니까?
왜 무한 루프가 있습니까? 오 잘 어쨌든이의 xD의 tyvm 작동 음 –
무한대 – paxdiablo
무한 = 재미의 xD에게 :-) 실제로 – blood