ctime,怎么写进文件中
问一下,用ctime(&tt)得到的时间,我用个String wrh1,变量来存,可写到文件中就不对,应该怎么写呢
time(&tt);
wrh1=ctime(&tt);
myf<<"从440--452开出时间:"<<wrh1;
还有我买了3张MSDN,怎么看呀,*。HXI文件呀
#include <iostream>
#include <fstream>
using namespace std;
#include <time.h>
#include <stdio.h>
void main( void )
{
char *saveTime;
time_t ltime;
time( <ime );
saveTime = ctime( <ime );
printf( "The time is %s\n", saveTime);
ofstream out("time.txt");
out<<saveTime<<endl;
}