void childSigalarm() { char *child; if(sonPID==0) // this means current process is son child="son "; else child="daughter"; printf("%s wrote %d to %s\n",child,incrementFile(),fname); kill(parentPID,SIGALRM); }
/* load ******************************************************************************************* - loads a file into the device ************************************************************************************************ */ void LoadableDevice_impl::load (CF::FileSystem_ptr fs, const char *fileName, CF::LoadableDevice::LoadType loadKind) throw (CORBA::SystemException, CF::Device::InvalidState, CF::LoadableDevice::InvalidLoadKind, CF::InvalidFileName, CF::LoadableDevice::LoadFail) { //CF::File_ptr fileToLoad; // file pointer bool readOnly = true; // read only flag // verify that the device is in a valid state for loading if (!isUnlocked () || isDisabled ()) { throw (CF::Device:: InvalidState ("Cannot load. System is either LOCKED, SHUTTING DOWN or DISABLED.")); } // verify that the loadKind is supported (only executable is supported by this version) if (loadKind != CF::LoadableDevice::EXECUTABLE) { throw CF::LoadableDevice::InvalidLoadKind (); } // verify the file name exists in the file system and get a pointer to it // NOTE: in this context, this step is redundant; the 'installApplication' method // already performs this existence check /* if (!fs->exists ((char *) fileName)) throw (CF::InvalidFileName (CF::CFENOENT, "Cannot load. File name is invalid.")); */ // pass fileToLoad to API (device specific, not currently implemented) // check if file loaded correctly //if (API unsuccessful) //{ // throw(CF::LoadableDevice::LoadFail("Cannot load. Attempt to load to device unsuccessful.")); // return; //} // add filename to loadedfiles. If it's been already loaded, then increment its counter incrementFile (fileName); //CORBA::release (fileToLoad); }
PlsParser::PlsParser (QString playlistSource) { auto lines = playlistSource.split ('\n'); i = 1; updatePrefixes (); QString fileName, title; foreach (auto line, lines) { if (line.startsWith (filePrefix)) { fileName = line.mid (filePrefix.length ()); } else if (line.startsWith (titlePrefix)) { title = line.mid (titlePrefix.length ()); output.append (SongData (fileName, title)); incrementFile (); } } }