[root@GZMJ_Logic_2 ]# cat lys.cpp
#include "stdio.h"
#include <iostream>
#include<time.h>
#include<stdlib.h>
#include <fstream>
#include <string>
#include<ctime>
using namespace std;
int main ()
{ for( ; ; )
{
time_t timep;
time (&timep);
//printf("%s", ctime(&timep)); //time_t now_time;
//now_time = time(NULL);
usleep(); ofstream ofresult( "game.log",ios::app);
ofstream ofresult_pid( "game.pid",ios::app);
//cout<<"game ok"<<endl;
//ofresult<< ctime(&timep) <<" game "<<" ok "<<endl;
ofresult<< ctime(&timep)<<" game "<<" ok "<<endl;
ofresult_pid<<""<<endl;
//ofresult<<" game "<<" ok "<<endl;
//ofresult<<"[ "<<now_time<<" ]"<<" game "<<" ok "<<endl;
//ofresult<<now_time<<endl;
} }
[root@GZMJ_Logic_2 1]# g++ lys.cpp -o lys
[root@GZMJ_Logic_2 1]# ./lys