void reteneitor3000::crearTexto(){
  QFile text_file("/tmp/reteneitor3000");

  qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
  if (text_file.open(QIODevice::WriteOnly)){
    QTextStream text_stream(&text_file);
    text_stream << ui->texto->toPlainText();
  }
  else
    error("No se pudo crear archivo temporal");
  text_file.close();
}
예제 #2
0
void Indicadores::UpdateLog(QString file)
{
    QString Path=QCoreApplication::applicationDirPath().toLatin1();
    QFile text_file(Path + "/Logs/" + file ); // link the text file with the QFile object

    if (text_file.open(QIODevice::ReadOnly)) // try to open the file. Mode: Read only
    {
        QTextStream text_stream(&text_file); // set the interface for reading the text
        TLog->setText(text_stream.readAll());
    }

    text_file.close();  // close the file
}
예제 #3
0
파일: main.cpp 프로젝트: CCJY/coliru
int main()
{
    std::istringstream text_file
    (
        "algorithms|CS104|5|DE Knuth\n"
        "Andrei|Tarkovsky|5|25|01/12/2013|31/03/2014\n"
        "Yasujiro|Ozu|4.5|22.5|01/12/2013|31/03/2014\n"
        "end_roster|\n"
        "metaprogramming|CS201|4|Dave Abrahams\n"
        "Ingmar|Bergman|4.7|18.8|01/12/2013|31/03/2014\n"
        "Bela|Tarr|4.5|18|01/12/2013|31/03/2014\n"
        "Krzysztof|Kieslowski|4.6|18.4|01/12/2013|31/03/2014\n"
        "end_roster|\n"
    );

    std::vector<course> roster ;

    std::string line ;
    while( std::getline( text_file, line ) )
    {
        course c ;
        if( to_course( line, c ) )
        {
            student s ;
            while( std::getline( text_file, line ) && to_student( line, s ) )
                c.students.push_back(s) ;
        }
        roster.push_back(c) ;
    }

    for( const course& c : roster )
    {
        std::cout << c.course_code << ' ' << c.course_name << ": "
                   << c.professor_name << '\n' ;

        for( const student& s : c.students )
            std::cout << "    " << s.first_name << ' ' << s.last_name << '\n' ;

        std::cout << '\n' ;
    }
}
예제 #4
0
void BoundaryCreator::PrintResults(std::ostream &stream)
{
    std::ofstream text_file("boundary.bndry");

    std::ostringstream ss("det", std::ios::out|std::ios::app);
    for (UInt_t i=0; i<fGrids.size(); i++)
    {
        ss.clear(); ss.str("det");
        ss << i;

        stream << "\n";
        GSBoundaryFinder gsbf(fGrids.at(i));
        gsbf.WriteBoundaryTo(stream, ss.str());

        text_file << "\n";
        gsbf.WriteBoundaryTo(text_file,ss.str());
    }
    stream << std::endl;
    text_file << std::endl;

    text_file.close();
}