/* Decide if the dependency identified by item is in a onedir or onfile archive * then call the appropriate function. */ static int _extract_dependency(ARCHIVE_STATUS *archive_pool[], const char *item) { ARCHIVE_STATUS *status = NULL; ARCHIVE_STATUS *archive_status = archive_pool[0]; char path[PATH_MAX]; char filename[PATH_MAX]; char srcpath[PATH_MAX]; char archive_path[PATH_MAX]; char dirname[PATH_MAX]; VS("LOADER: Extracting dependencies\n"); if (splitName(path, filename, item) == -1) return -1; pyi_path_dirname(dirname, path); /* We need to identify three situations: 1) dependecies are in a onedir archive * next to the current onefile archive, 2) dependencies are in a onedir/onefile * archive next to the current onedir archive, 3) dependencies are in a onefile * archive next to the current onefile archive. */ VS("LOADER: Checking if file exists\n"); // TODO implement pyi_path_join to accept variable length of arguments for this case. if (checkFile(srcpath, "%s%s%s%s%s", archive_status->homepath, PYI_SEPSTR, dirname, PYI_SEPSTR, filename) == 0) { VS("LOADER: File %s found, assuming is onedir\n", srcpath); if (copyDependencyFromDir(archive_status, srcpath, filename) == -1) { FATALERROR("Error coping %s\n", filename); return -1; } // TODO implement pyi_path_join to accept variable length of arguments for this case. } else if (checkFile(srcpath, "%s%s%s%s%s%s%s", archive_status->homepath, PYI_SEPSTR, "..", PYI_SEPSTR, dirname, PYI_SEPSTR, filename) == 0) { VS("LOADER: File %s found, assuming is onedir\n", srcpath); if (copyDependencyFromDir(archive_status, srcpath, filename) == -1) { FATALERROR("Error coping %s\n", filename); return -1; } } else { VS("LOADER: File %s not found, assuming is onefile.\n", srcpath); // TODO implement pyi_path_join to accept variable length of arguments for this case. if ((checkFile(archive_path, "%s%s%s.pkg", archive_status->homepath, PYI_SEPSTR, path) != 0) && (checkFile(archive_path, "%s%s%s.exe", archive_status->homepath, PYI_SEPSTR, path) != 0) && (checkFile(archive_path, "%s%s%s", archive_status->homepath, PYI_SEPSTR, path) != 0)) { FATALERROR("Archive not found: %s\n", archive_path); return -1; } if ((status = _get_archive(archive_pool, archive_path)) == NULL) { FATALERROR("Archive not found: %s\n", archive_path); return -1; } if (extractDependencyFromArchive(status, filename) == -1) { FATALERROR("Error extracting %s\n", filename); free(status); return -1; } } return 0; }
bool OutputPage::validatePage() { return checkFile(m_ui.projectLineEdit->text(), tr("Qt Help Project File")) && checkFile(m_ui.collectionLineEdit->text(), tr("Qt Help Collection Project File")); }
int main() { std::string txtPath = "../data/test.txt"; std::string symPath = "../data/SoftLink.txt"; std::string hardPath = "../data/HardLink.txt"; checkFile(txtPath); checkFile(symPath); checkFile(hardPath); return 0; }
int main(int argc, char **argv){ if(argc > 3) return 0; //Non-verbose mode else if(argc == 2){ input1 = fopen(argv[1], "r"); if(input1 == NULL) return 0; //printf("This obj file\n"); if (checkFile() == FALSE){ fprintf(stderr,"Wrong format\n"); return 0; } //printf("Correct format\n"); rewind(input1); _non_verbose = TRUE; process(); fclose(input1); } //Verbose mode else if(argc == 3){ input1 = fopen(argv[2],"r"); //printf("%s\n", argv[1]); if(input1 == NULL) return 0; else if ( strcmp(argv[1], "-v") == 0){ //process(); //printf("Verbose mode and file is not null \n"); if (checkFile() == FALSE){ fprintf(stderr,"Wrong format\n"); return 0; } //printf("Correct format\n"); rewind(input1); process(); fclose(input1); } //when argument is not "-v" else{ fprintf(stderr, "-V is expected on the 2nd argument %s\n", argv[1]); return 0; } } return 0; }
bool CppCheck::findError(std::string code, const char FileName[]) { std::set<unsigned long long> checksums; // First make sure that error occurs with the original code checkFile(code, FileName, checksums); if (_errorList.empty()) { // Error does not occur with this code return false; } std::string previousCode = code; std::string error = _errorList.front(); for (;;) { // Try to remove included files from the source std::size_t found = previousCode.rfind("\n#endfile"); if (found == std::string::npos) { // No modifications can be done to the code } else { // Modify code and re-check it to see if error // is still there. code = previousCode.substr(found+9); _errorList.clear(); checksums.clear(); checkFile(code, FileName, checksums); } if (_errorList.empty()) { // Latest code didn't fail anymore. Fall back // to previous code code = previousCode; } else { error = _errorList.front(); } // Add '\n' so that "\n#file" on first line would be found code = "// " + error + "\n" + code; replaceAll(code, "\n#file", "\n// #file"); replaceAll(code, "\n#endfile", "\n// #endfile"); // We have reduced the code as much as we can. Print out // the code and quit. _errorLogger.reportOut(code); break; } return true; }
MapPackLoader::FileList MapPackLoader::getFiles(int player_number) { FileList files; WIN32_FIND_DATA file; HANDLE search_handle = FindFirstFile("*.txt", &file); if (search_handle != nullptr) { do { MapFile map; bool result = false; try { map = checkFile(file, player_number, result); } catch (const std::exception&) { result = false; } if (result) files.push_back(map); } while (FindNextFile(search_handle, &file)); if (!IsDebuggerPresent()) CloseHandle(search_handle); } return files; }
Dialog::Dialog(QWidget *parent) : QDialog(parent), ui(new Ui::Dialog) { ui->setupUi(this); myDB = QSqlDatabase::addDatabase("QSQLITE"); QString pathToDB = QDir::currentPath()+QString("/Accounts.sqlite"); myDB.setDatabaseName(pathToDB); QFileInfo checkFile(pathToDB); if (checkFile.isFile()) { if (myDB.open()) { ui->lblResult->setText("[+] Connected to Database File"); } else { ui->lblResult->setText("[!] Database File was not opened"); } } else { ui->lblResult->setText("[!] Database File does not exist"); } }
fillCategories(char* file_path) { char* linebuffy; FILE* f; size_t chars; char* token; char* cat; size_t len = 0; linebuffy = NULL; if (!checkFile(file_path)) { printf("Error with filepath \n", file_path); exit(EXIT_FAILURE); } f = fopen(file_path, "r"); while ( (chars = getline(&linebuffy, &len, f)) != -1 ) { token = strtok(linebuffy, "\n\r"); cat = strdup(token); category_array[num_categories] = cat; num_categories++; } free(linebuffy); }
bool PrefsFile::writePrefVal(const QString &prefId, const QString &newVal) { if (filePath == NULL) return false; QString cnt; QFileInfo checkFile(filePath); if (!checkFile.exists()) { return false; } else { QString oldVal = this->fetchPrefVal(prefId); QFile f(filePath); if (f.open( QIODevice::ReadWrite )) { QTextStream rd(&f); cnt = rd.readAll(); } f.resize(0); //truncate f.close(); QString oldL(prefId + " " + oldVal); QString newL(prefId + " " + newVal); cnt.replace(oldL, newL); if (f.open( QIODevice::ReadWrite )) { QTextStream wr(&f); wr << cnt; return true; } } }
/* * void MainWindow::on_fileInputEdit_editingFinished() * When user (or program) has finished editing this field input will be checked * to see if it's a string or a file */ void MainWindow::on_fileInputEdit_editingFinished() { QString input; input = ui->fileInputEdit->text(); qDebug() << "\nUser's input: " << input; QFileInfo checkFile(input); //let's find out if we are working with a file or a string if(checkFile.exists() && checkFile.isFile()) { fileToGenerateFrom = new QFile(input); if(fileToGenerateFrom->open(QIODevice::ReadOnly)){ qDebug() << "on_fileInputEdit_editingFinished: Opened target file\n"; byteInput = fileToGenerateFrom->readAll(); stringToDB =fileToGenerateFrom->fileName(); fileToGenerateFrom->close(); } else { QMessageBox::critical(this,tr("Error opening a file!"),tr("Read error!")); } } //we are working with a string else { if(input != "") { byteInput.append(input); stringToDB = input; } } }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); myDB = QSqlDatabase::addDatabase("QSQLITE"); myDB.setDatabaseName(Path_to_DB); QFileInfo checkFile(Path_to_DB); if(checkFile.isFile()) { if(myDB.open()) { ui->lblResult->setText("[+]Connected to Database File :)"); } } else { ui -> lblResult -> setText("[!]Database file does not exits :("); } }
bool StorageGroup::FileExists(QString filename) { LOG(VB_FILE, LOG_DEBUG, LOC + QString("FileExist: Testing for '%1'").arg(filename)); bool badPath = true; if (filename.isEmpty()) return false; for (QStringList::Iterator it = m_dirlist.begin(); it != m_dirlist.end(); ++it) { if (filename.startsWith(*it)) { badPath = false; } } if (badPath) return false; bool result = false; QFile checkFile(filename); if (checkFile.exists(filename)) result = true; return result; }
int main() { //create an input stream object std::ifstream ifs; //open file for input std::string fileName = "regDB.csv"; ifs.open(fileName, std::ios::in); checkFile(ifs); //parse data and read from file std::cout << "*** Reading from " << fileName << " ***\n\n"; std::vector<std::string> data = parseInputFile(ifs); //print parsed data to stdout int j = 0; for (auto i = data.begin(); i != data.end(); ++i) { std::cout << *i; if (!(++j % 3)) //print a newrecord after processing three fields std::cout << '\n'; else std::cout << ' '; } ifs.close(); }
void CFile::readAttributesOfEnabledFieldsInReadMode() { if (enabledFields.empty()) return; // Just check file and try to open it CContext* context = CContext::getCurrent(); CContextClient* client=context->client; // It would probably be better to call initFile() somehow MPI_Comm_dup(client->intraComm, &fileComm); if (time_counter_name.isEmpty()) time_counter_name = "time_counter"; checkFile(); for (int idx = 0; idx < enabledFields.size(); ++idx) { // First of all, find out which domain and axis associated with this field enabledFields[idx]->solveGridReference(); // Read attributes of domain and axis from this file this->data_in->readFieldAttributesMetaData(enabledFields[idx]); // Now complete domain and axis associated with this field enabledFields[idx]->solveGenerateGrid(); // Read necessary value from file this->data_in->readFieldAttributesValues(enabledFields[idx]); // Fill attributes for base reference enabledFields[idx]->solveGridDomainAxisBaseRef(); } // Now everything is ok, close it close(); }
void DBQuery::connect() { //QDir::setCurrent(QCoreApplication::applicationDirPath()); QFile temp("svamp.temp"); if(temp.open(QIODevice::ReadOnly | QIODevice::Text)) { QTextStream fin(&temp); dbPath = fin.readLine(); if(dbPath.isEmpty()) this->closeDB(); else myDB.setDatabaseName(dbPath); temp.close(); } QFileInfo checkFile(dbPath); if(checkFile.isFile()) { if(myDB.open()) { emit statusUpdate("Database connection successfull"); qDebug() << "Database connection succesfull"; } }else{ emit statusUpdate("Database file doesn't exist"); qDebug() << "Db file not found"; } }
int main() { //create an output stream object std::ofstream ofs; //open file for output std::string fileName = "regDB.csv"; ofs.open(fileName, std::ios::out); checkFile(ofs); char data[S]; //prompt user for data and write to file std::cout << "*** Writing to file ***\n\n"; std::cout << "Enter first name: "; writeData(ofs, data, false); std::cout << "Enter last name: "; writeData(ofs, data, false); std::cout << "Enter email address: "; writeData(ofs, data, true); std::cout << "\nYour data has been saved in " << fileName << std::endl; ofs.close(); }
void Model::readDatabase(const QString &databaseFile) { QFileInfo checkFile(databaseFile); if (!checkFile.isFile()) { emit errorMessage("Cannot open database file."); return; } QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE"); db.setDatabaseName(databaseFile); const bool ok = db.open(); if (!ok) { emit errorMessage("Cannot read database file."); return; } QSqlQuery query; if (!query.exec("SELECT id, vod_path FROM VideoMessages")) { db.close(); emit errorMessage("Cannot query video path from database."); return; } reset(); while (query.next()) { const QString id = query.value(0).toString(); const QString vodPath = query.value(1).toString(); addItem(id, vodPath); } db.close(); }
void dumpFile(const char *filepath, char **pbuffer, size_t *plength) { if (!checkFile(filepath)) { #ifdef DEBUG fprintf(stderr, "glkit: Failed to read %s.\n", filepath); #endif *pbuffer = NULL; *plength = 0; return; } FILE *fileHandle = fopen(filepath, "r"); fseek(fileHandle, 0, SEEK_END); size_t fileLength = ftell(fileHandle); fseek(fileHandle, 0, SEEK_SET); *pbuffer = new char [fileLength + 1]; fread(*pbuffer, 1, fileLength, fileHandle); (*pbuffer)[fileLength] = '\0'; fclose (fileHandle); if (plength) { *plength = fileLength; } }
int main (int argc, char *argv[]) { FILE *fp; char *filename; // if (argc < 2) { usage (argc, argv); exit(1); } filename = argv[1]; fp = fopen (filename, "rb"); if (!fp) { fprintf (stderr, "Error: Failed opening %s\n", argv[1]); return 1; } // file checks if (checkFile (fp) < 0) { fprintf(stderr, "Error: File analysis failed\n"); exit(1); } // dump file :) if (PeCheck(fp)) { pe_dump(fp); } else if (ElfCheck(fp)) { elf_dump(fp); } fclose(fp); return 0; }
/* yeah this function is a little weird, but I'm mimicking Lua's actual code for io:write() */ WSLUA_METHOD File_write(lua_State* L) { /* Writes to the File, similar to Lua's file:write(). See Lua 5.x ref manual for file:write(). */ File f = checkFile(L,1); int arg = 2; /* beginning index for arguments */ int nargs = lua_gettop(L) - 1; int status = TRUE; int err = 0; if (!f->wdh) { g_warning("Error in File read: this File object instance is for reading only"); return 0; } lua_pushvalue(L, 1); /* push File at the stack top (to be returned) */ for (; nargs--; arg++) { size_t len; const char *s = luaL_checklstring(L, arg, &len); status = wtap_dump_file_write(f->wdh, s, len, &err); if (!status) break; f->wdh->bytes_dumped += len; } if (!status) { lua_pop(L,1); /* pop the extraneous File object */ lua_pushnil(L); lua_pushfstring(L, "File write error: %s", g_strerror(err)); lua_pushinteger(L, err); return 3; } return 1; /* File object already on stack top */ }
int main(int argc, const char *argv[]) { if (argc < 2) { fprintf(stderr, "usage: %s <file>\n", argv[0]); return -1; } const char* innerFile = ""; if (argc == 3) innerFile = argv[2]; zzip_error_t errcode; ZZIP_DIR* dir = zzip_dir_open(argv[1], &errcode); if (dir == NULL) { fprintf(stderr, "zzip_operdir failed: %s\n", zzip_strerror(errcode)); return -1; } // scan files ZZIP_DIRENT* dirent = zzip_readdir(dir); while (dirent) { printf("%s, compression %d, size %d/%d\n", dirent->d_name, dirent->d_compr, dirent->d_csize, dirent->st_size); checkFile(dir, dirent, innerFile); dirent = zzip_readdir(dir); } int err = zzip_closedir(dir); if (err != 0) { fprintf(stderr, "zzip_closedir failed: %s\n", zzip_strerror_of(dir)); return -1; } return 0; }
KonfUpdate::KonfUpdate() : m_textStream(0), m_file(0) { bool updateAll = false; m_oldConfig1 = 0; m_oldConfig2 = 0; m_newConfig = 0; m_config = new KConfig("kconf_updaterc"); KConfigGroup cg(m_config, QString()); QStringList updateFiles; KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); m_debug = args->isSet("debug"); m_bUseConfigInfo = false; if (args->isSet("check")) { m_bUseConfigInfo = true; QString file = KStandardDirs::locate("data", "kconf_update/" + args->getOption("check")); if (file.isEmpty()) { qWarning("File '%s' not found.", args->getOption("check").toLocal8Bit().data()); log() << "File '" << args->getOption("check") << "' passed on command line not found" << endl; return; } updateFiles.append(file); } else if (args->count()) { for (int i = 0; i < args->count(); i++) { KUrl url = args->url(i); if (!url.isLocalFile()) { KCmdLineArgs::usageError(i18n("Only local files are supported.")); } updateFiles.append(url.path()); } } else { if (cg.readEntry("autoUpdateDisabled", false)) return; updateFiles = findUpdateFiles(true); updateAll = true; } for (QStringList::ConstIterator it = updateFiles.constBegin(); it != updateFiles.constEnd(); ++it) { updateFile(*it); } if (updateAll && !cg.readEntry("updateInfoAdded", false)) { cg.writeEntry("updateInfoAdded", true); updateFiles = findUpdateFiles(false); for (QStringList::ConstIterator it = updateFiles.constBegin(); it != updateFiles.constEnd(); ++it) { checkFile(*it); } updateFiles.clear(); } }
void *producer(void *args) { FILE *file; char *category; char *linebuffer; char *title; char *file_path; const char *delims = "|\n\r"; float price; int c_id; orderPTR order; size_t len; ssize_t read; len = 0; file_path = (char*) args; int fileintegrity = checkFile(file_path); if (!fileintegrity) { printf("Problem opening file :( \n"); exit(EXIT_FAILURE); } file = fopen(file_path, "r"); linebuffer = NULL; while ( (read = getline(&linebuffer, &len, file)) != -1 ) { title = strtok(linebuffer, delims); price = atof(strtok(NULL, delims)); c_id = atoi(strtok(NULL, delims)); category = strtok(NULL, delims); /* for (int i = 0; i < 500; i++) { if (!strcmp(category_array[i], category)) { break; } } */ order = createOrder(title, price, c_id, category); pthread_mutex_lock(&queue->mutex); enqueue(queue,(void*) order); pthread_mutex_unlock(&queue->mutex); pthread_cond_signal(&queue->NOTempty); } alldone = 1; pthread_cond_broadcast(&queue->NOTempty); free(linebuffer); fclose(file); return NULL; }
int main() { ifstream fin; // ofstream fout; bool read_check = false; do { cout << "輸入指令:"; string command; cin >> command; Data *data; /*進入模式*/ if(command == "read"){ fin.open("source.txt",ios::in); checkFile(fin); read_check = true; int line = countLine(fin); fin.close(); // cout<<line<<endl; data = new Data(line); data->inputData(); data->printData(); } else if(command == "sort"){ /*TODO fix compare*/ if(!read_check){ cout << "還未讀取資料,請先讀取" <<endl; continue; } data->sortData(); data->printData(); } else if(command == "add"){ if(!read_check){ cout << "還未讀取資料,請先讀取" <<endl; continue; } string input_id, input_name; cout << "請輸入學號:"; cin >> input_id; cout << "請輸入姓名:"; cin >> input_name; } else if(command == "find"){ if(!read_check){ cout << "還未讀取資料,請先讀取" <<endl; continue; } } else if(command == "delete"){ delete data; read_check = false; } else if(command == "exit"){ break; } else{ cout << "沒有此指令" << endl; } } while(true);
int main(int argc, char* argv[]){ int n = argc - 3, i; char* files[n]; if(argc < 4){ printf("Input invalido: Esperado \"tempo palavra file1 ... fileN\" \n"); return -1; } if( (tempo = parse_int(argv[1])) == LONG_MAX ) return -1; char* palavra = argv[2]; for(i = 0; i < n; i++){ if( checkFile(argv[i+3]) == -1 ) printf("O ficheiro %s nao existe \n", argv[i+3]); else{ files[num_pids] = argv[i+3]; num_pids++; } } if(num_pids == 0){ printf("Nao encontrado nenhum ficheiro \n"); return -1; } pids = malloc (sizeof(int) * num_pids); for (i = 0; i < num_pids; i++){ if( (*(pids + i) = fork()) == -1 ){ printf("Erro fork \n"); return -1; } if(*(pids + i) == 0 ) /* FILHO */ { ficheiro(files[i], palavra); exit(0); } } if( (pidCheck = fork()) == -1 ){ printf("Erro fork \n"); exit(1); } if( pidCheck == 0) checkFiles(pids, files, num_pids); signal(SIGALRM, alarmhandler); signal(SIGINT, inthandler); alarm(tempo); int status; for(i = 0; i < num_pids; i++) wait(&status); return 0; }
int loadParamData(HfInfo* file, BlasParamInfo* bParam) { int status = 0; int i = 0; int ret = 0; bool dimExist = true; for (i =0; i < MAX_SUBDIMS; i++){ unsigned int temp; status+= hfRead(file, &temp, 1, sizeof(temp)); bParam->sDim[i].x = (size_t)temp; status+= hfRead(file, &temp, 1, sizeof(temp)); bParam->sDim[i].y = (size_t)temp; status+= hfRead(file, &temp, 1, sizeof(temp)); bParam->sDim[i].itemX = (temp >= SUBDIM_UNUSED_FILE_VALUE) ? SUBDIM_UNUSED : (size_t)temp; status+= hfRead(file, &temp, 1, sizeof(temp)); bParam->sDim[i].itemY = (temp >= SUBDIM_UNUSED_FILE_VALUE) ? SUBDIM_UNUSED : (size_t)temp; status+= hfRead(file, &temp, 1, sizeof(temp)); bParam->sDim[i].bwidth = (size_t)temp; } status += hfRead(file, &bParam->pGran, 1, sizeof(PGranularity)); status += hfRead(file, bParam->kernel, 1, sizeof(POSFILE) * MAX_CLBLAS_KERNELS_PER_STEP); status += hfRead(file, bParam->kSize, 1, sizeof(bParam->kSize)); status += hfRead(file, &bParam->time, 1, sizeof(double) ); if ((status == FILE_OK) && (bParam->sDim[0].y == 0)) { dimExist = false; } status += hfCheckCRC(file); if (!dimExist && (status == FILE_ERROR_CRC)) { ret = 1; // file is valid but doesn't have actual data } else if (!checkFile(file, (size_t)bParam->offset + bParam->size, status)) { ret = -1; // file is corrupted } else if (bParam->time > 10000.0) { ret = 1; } if (ret) { memset(bParam->sDim, 0, sizeof(SubproblemDim) * MAX_SUBDIMS); memset(&bParam->pGran, 0, sizeof(PGranularity) ); memset(bParam->kernel, 0, sizeof(POSFILE) * MAX_CLBLAS_KERNELS_PER_STEP ); memset(bParam->kSize, 0, sizeof(unsigned int) * MAX_CLBLAS_KERNELS_PER_STEP ); bParam->time = 1e50; // any large number; } return ret; }
/****************************************************************************** * Called when the OK button is clicked. */ void SoundDlg::slotOk() { if(mReadOnly) reject(); if(!checkFile()) return; accept(); }
bool CommonFunctions::checkIfFileExists(QString path) { QFileInfo checkFile(path); if (checkFile.exists() && checkFile.isFile()) { return true; } else { return false; } }
bool fileExists(QString const& _filename) { QFileInfo checkFile(_filename); // check if file exists and if yes: Is it really a file and no directory? if (checkFile.exists() && checkFile.isFile()) return true; return false; }
// This function is called by the MIPS firmware save or write function. The cmd // string passed contains the programmer invocation command. void Program::executeProgrammerCommand(QString cmd) { QString pcheck; // Select the Terminal tab and clear the display console->clear(); // Make sure the app is connected to MIPS if(!comms->serial->isOpen()) { console->putData("This application is not connected to MIPS!\n"); return; } // Make sure we can locate the programmer tool... #if defined(Q_OS_MAC) pcheck = appPath + "/bossac"; #else pcheck = appPath + "/bossac.exe"; #endif QFileInfo checkFile(pcheck); if (!checkFile.exists() || !checkFile.isFile()) { console->putData("Can't find the programmer!\n"); console->putData(cmd.toStdString().c_str()); return; } // Enable MIPS's bootloader console->putData("MIPS bootloader enabled!\n"); qDebug() << "Bootloader enabled"; comms->closeSerialPort(); QThread::sleep(1); while(comms->serial->isOpen()) QApplication::processEvents(); QThread::sleep(1); comms->serial->setBaudRate(QSerialPort::Baud1200); QApplication::processEvents(); comms->serial->open(QIODevice::ReadWrite); comms->serial->setDataTerminalReady(false); QThread::sleep(1); comms->serial->close(); QApplication::processEvents(); QThread::sleep(5); // Perform selected bootloader function and restart MIPS QApplication::processEvents(); console->putData(cmd.toStdString().c_str()); console->putData("\n"); QApplication::processEvents(); QStringList arguments; arguments << "-c"; arguments << cmd; // arguments << " -h"; #if defined(Q_OS_MAC) process.start("/bin/bash",arguments); #else process.start(cmd); #endif console->putData("Operation should start soon...\n"); connect(&process,SIGNAL(readyReadStandardOutput()),this,SLOT(readProcessOutput())); connect(&process,SIGNAL(readyReadStandardError()),this,SLOT(readProcessOutput())); }