1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
time_t rawtime;
time (&rawtime);
char dayWhenFileWasLastWritten[80] = "0";
char currentday[80] = "0";
char currentdate[80];
strftime(dayWhenFileWasLastWritten,80,"%d",localtime (&rawtime));
ofstream rawfile(currentdate);
while ((timediff < m_time) || m_time == 0)
{
cout << "test2...\n";
strftime(currentday,80,"%d",localtime (&rawtime));
strftime(currentdate,80,"%Y-%m-%d",localtime (&rawtime));
cout << "test3...\n";
if ( currentday != dayWhenFileWasLastWritten) {
cout << "test4...\n";
//if (strftime("%d") != dayWhenFileWasLastWritten.c_str()) {
errorcode = CAENVME_SetOutputRegister(Handle, Mask); // Sets the NIM Level of channel0 output to a logical 1 in order to prevent from any events being written to the QDC and the GPS Card.
if (rawfile != NULL && rawfile.is_open()) {
rawfile.close();
}
//string completename = prefix+suffix;
//ofstream rawfile("rawfile" + currentday + ".dat");
ofstream rawfile(currentdate".dat");
//dayWhenFileWasLastWritten = strftime("%d");
//strftime (dayWhenFileWasLastWritten,80,"%d",localtime ( &rawtime ));
strftime(dayWhenFileWasLastWritten,80,"%d",localtime (&rawtime));
errorcode1 = CAENVME_ReadCycle(Handle, clearreg, &data, cvA24_U_DATA, cvD16);
mbg_clr_ucap_buff(dh);
errorcode = CAENVME_ClearOutputRegister(Handle, Mask); // Sets the NIM Level of channel0 output to a logical 0 in order to let events come through to the GPS Card and the QDC
errorcode1 = CAENVME_ReadCycle(Handle, statusreg, &data,cvA24_U_DATA, cvD16);
READY = (data & 0x8000)/32678;
while (READY ==0)
{
//read status
errorcode1 = CAENVME_ReadCycle(Handle, statusreg,&data,cvA24_U_DATA, cvD16);
READY = (data & 0x8000)/32678;
}
}
|