void monitorForm::int()
{
stationNum="1234";
stationLoc="hello";
operatorName="hihi";
operatorTel="12345678";
installationDate="10/10/2000";
maintenanceDate="22/22/2000";
saveInfo(operatorTel,operatorName,stationNum,stationLoc,installationDate,maintenanceDate);
}
/*.....*/
{
//convert to ASCII
QCString tOT = tempOperTel.local8Bit();
QCString tON = tempOperName.local8Bit();
QCString tSN = tempStatNum.local8Bit();
QCString tSL = tempStatLoc.local8Bit();
QCString tID = tempInstallDate.local8Bit();
QCString tMD = tempMaintenDate.local8Bit();
int tOTL = tOT.length();
int tONL = tON.length();
int tSNL = tSN.length();
int tSLL = tSL.length();
int tIDL = tID.length();
int tMDL = tMD.length();
const char *savingStrs=tOT+tON+tSN+tSL+tID+tMD;
int savingLength = tOTL + tONL + tSNL + tSLL + tIDL + tMDL ;
printf("savingStrs = %s\n",savingStrs);
printf("%d+%d+%d+%d+%d+%d = %d\n",tOTL , tONL , tSNL , tSLL , tIDL , tMDL , savingLength);
//lock the file for writing
memset (&lock, 0, sizeof(lock));
lock.l_type = F_WRLCK;
fcntl (fd, F_SETLKW, &lock);
//file_memory is a pointer to the zero offset of the sh.mem. segment
//opcode offset is just an offset in the sh.mem where we write some index values
*((char*)file_memory+wOpcodeOffset) = 9;
struct ShMem *infoVar=(ShMem*)((char*)file_memory);
infoVar->oTL = tOTL;
infoVar->oNL = tONL;
infoVar->sNL = tSNL;
infoVar->sLL = tSLL;
infoVar->iDL = tIDL;
infoVar->mDL = tMDL;
printf("hello\n");
memcpy(infoVar->oAndS_str, savingStrs, savingLength);
printf("hello2\n");
//unlock the file to allow access
lock.l_type = F_UNLCK;
fcntl (fd, F_SETLKW, &lock);
}
void monitorForm::int()
{
stationNum="1234";
stationLoc="hello";
operatorName="hihi";
operatorTel="12345678";
installationDate="10/10/2000";
maintenanceDate="22/22/2000";
saveInfo(operatorTel,operatorName,stationNum,stationLoc,installationDate,maintenanceDate);
}
/*.....*/
void monitorForm::saveInfo(QString tempOperTel, QString tempOperName, QString tempStatNum, QString tempStatLoc,
QString tempInstallDate, QString tempMaintenDate)
{
//convert to ASCII
QCString tOT = tempOperTel.local8Bit();
QCString tON = tempOperName.local8Bit();
QCString tSN = tempStatNum.local8Bit();
QCString tSL = tempStatLoc.local8Bit();
QCString tID = tempInstallDate.local8Bit();
QCString tMD = tempMaintenDate.local8Bit();
int tOTL = tOT.length();
int tONL = tON.length();
int tSNL = tSN.length();
int tSLL = tSL.length();
int tIDL = tID.length();
int tMDL = tMD.length();
const char *savingStrs=tOT+tON+tSN+tSL+tID+tMD;
int savingLength = tOTL + tONL + tSNL + tSLL + tIDL + tMDL ;
printf("savingStrs = %s\n",savingStrs);
printf("%d+%d+%d+%d+%d+%d = %d\n",tOTL , tONL , tSNL , tSLL , tIDL , tMDL , savingLength);
//lock the file for writing
memset (&lock, 0, sizeof(lock));
lock.l_type = F_WRLCK;
fcntl (fd, F_SETLKW, &lock);
//file_memory is a pointer to the zero offset of the sh.mem. segment
//opcode offset is just an offset in the sh.mem where we write some index values
*((char*)file_memory+wOpcodeOffset) = 9;
struct ShMem *infoVar=(ShMem*)((char*)file_memory);
infoVar->oTL = tOTL;
infoVar->oNL = tONL;
infoVar->sNL = tSNL;
infoVar->sLL = tSLL;
infoVar->iDL = tIDL;
infoVar->mDL = tMDL;
printf("hello\n");
memcpy(infoVar->oAndS_str, savingStrs, savingLength);
printf("hello2\n");
//unlock the file to allow access
lock.l_type = F_UNLCK;
fcntl (fd, F_SETLKW, &lock);
}
To copy to clipboard, switch view to plain text mode
Bookmarks