/* Name: find Desc: converts the hidden message to a readable string Args: in : input string out : output file ( e.g. stdout ) Returns: - */ void find(char* in, FILE * out) { char* word; char* ptr; for (word = strtok_r(in, " .", &ptr); word; word = strtok_r(NULL, " .", &ptr)) { // split line at ' ' and '.' characters int index = wordToChar(word); if (index == -1) continue; char c; if (index >= 0 && index < 26) c = index + 'a'; else if (index == 26) c = '.'; else if (index == 27) c = ' '; else continue; CHECK_PRINTF(fprintf(out, "%c", c)) } }
void twoWayFiles::renameFilePath(fileName& particleFilePathOld,word& name) const { const char* charName = wordToChar(name); char timeStep[40]; // file touched by CFD strcpy(timeStep, charName); strcat(timeStep,"0"); fileName particleFilePath(particleCloud_.mesh().time().path()/"couplingFiles"/timeStep); // rename old file rename(fileNameToChar(particleFilePathOld),fileNameToChar(particleFilePath)); }
fileName twoWayFiles::getFilePath(word& name, bool in) const { const char* charName = wordToChar(name); char timeStep[40]; // file touched by DEM strcpy(timeStep, charName); strcat(timeStep,"1"); fileName particleFilePathOld(particleCloud_.mesh().time().path()/"couplingFiles"/timeStep); //NP no waiting when writing out at first time if (couplingStep() > 1 || in) { Info << "wait for file " << particleFilePathOld << endl; struct stat st; while (stat(fileNameToChar(particleFilePathOld),&st)) sleep(0.03); } return particleFilePathOld; }