您是否看到任何原因,因为 processName 不会被写入 sysSettings 文件,如果它不存在?我不知道为什么它不在那里写。请帮忙 !!!
void pushSysSet(const char* processName)
{
char oneLine[15];
fstream sysSettings;
sysSettings.open("p_appmanager/src/sys_settings.txt",ios::in | ios:: out | ios::app);
if(!sysSettings.is_open())
{
if(debugFlag)
{
cout<<currentTime()<<"::"<<"Unable to open sys_settings file"<<strerror(errno)<<endl;
cout.flush();
}
return;
}
while(!((sysSettings.getline(oneLine,sizeof(oneLine))).eof()))
{
if(!strcmp(oneLine,processName))
return;
}
sysSettings<<processName;
sysSettings.flush();
sysSettings.close();
}