std::string FileSystem::append(const std::string & source, const std::string & app) { int r; r = mCurrDir->GetChildFile(&mMemblockDevice, source); if (r == -1) return "Source file not found.\n"; File files; r = files.Read(&mMemblockDevice, r); if (r == -1) return "Feeeel\n"; r = mCurrDir->GetChildFile(&mMemblockDevice, app); if (r == -1) return "Append file not found.\n"; File filea; r = filea.Read(&mMemblockDevice, r); if (r == -1) return "Feeeel\n"; r = files.AddData(&mMemblockDevice, filea.ToString()); if (r == -1) return "Feeeel\n"; return ""; }
void WriteToFile(const string& filename) { string str = ""; int flag = fcntl(stdin->_fileno, F_GETFL); fcntl(stdin->_fileno, F_SETFL, flag | O_NONBLOCK); ctrl_c_pressed = 0; while (!ctrl_c_pressed) { char c; if (read(0, &c, 1) > 0) str += c; } ctrl_c_pressed = 0; fcntl(stdin->_fileno, F_SETFL, flag); File* newFile = new File(); newFile->AddData(str); files[filename] = newFile; }