QFileInfoList Parser::getOutputFiles(){ //TODO sort output // use QDirIterator only for directories // then use // QDir::entryInfoList( m_file_extension, // QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot, // QDir::Name ); QFileInfoList l_out; QDir l_in( m_input_dir ); QDirIterator l_it( l_in.absolutePath(), QDirIterator::Subdirectories ); while( l_it.hasNext() ){ l_it.next(); QFileInfo l_file = l_it.fileInfo(); if( !l_file.isDir() ){ if( !( m_file_hidden && l_file.isHidden() ) ){ if( !m_file_extension.isEmpty() && m_file_extension.contains( l_file.suffix() ) ){ l_out.push_back( l_file ); } } } } return l_out; }
void int_80r(FileDesc fd, void * buff, int size) { int i = 0; switch(fd) { case KEYBOARD: k_read((char *)buff,size); break; case SCREENNL: s_read((char *)buff,size); break; case PCI : l_in(0xCFC, buff,size); break; } }
/** * @brief Sets the text contained in the given file in the TextView * @param p_title * @param p_filename */ void TextViewer::setFileContents(QString p_title, QString p_filename) { clearViewer(); ui->retryButton->hide(); QFile l_if(p_filename); l_if.open(QIODevice::ReadOnly); QTextStream l_in(&l_if); QString l_line = l_in.readAll(); l_if.close(); QString l_contents = "<head><style type='text/css'> a:link{color:white;} a:visited{color:white;} a:active{color:white;} a:hover{color:white; text-decoration:none;} </style></head><div style='color:white;'><h3>"; l_contents.append(p_title + "</h3><hr>"); l_contents.append(l_line); ui->TextView->append(l_contents); ui->TextView->moveCursor(QTextCursor::Start); }
bool CTarArchive::WriteData(const std::string& _input, const std::string& output) { bool Ret = false; /*int iAmountToRound = 0; static bool bFirstEntry = true; std::fstream f_In, f_Out; std::string strData = strTarfile;*/ posix_header lheader; if(FillHeader(_input, lheader)) { std::ofstream l_out(output.c_str(), std::ios::out | std::ios::binary | std::ios::app | std::ios::ate); if(!l_out.good()) { std::cerr << i8n("[ERR] Error output file: ") << output << '\n'; Ret = false; } else { std::ifstream l_in(_input.c_str(), std::ios::in | std::ios::binary); if(!l_in.good()) { std::cerr << i8n("[WNG] Error in file: ") << _input << i8n(" (file is skipped)") << '\n'; Ret = true; // If we cannot read a file it's not vital, we skip, but we need to inform user ! } else { //Round it to % 512 if(m_FirstFile) { int l_AmountToRound = RoundTo512(l_out.tellp()) - l_out.tellp(); for(int i = 0; i < l_AmountToRound; ++i) l_out.put('\0'); } m_FirstFile = true; //Write header l_out.write(reinterpret_cast<char*>(&lheader), sizeof(lheader)); //Append file content char l_char; while(l_in.get(l_char)) l_out.put(l_char); l_in.close(); l_out.close(); Ret = true; } } } else { std::cerr << i8n("[WNG] File '") << _input << i8n("' hasn't been add to tar archive !") << '\n'; Ret = true; // If we cannot compute header, we skip it. } return Ret; }