Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void InpFile(QLineEdit *Inp, QTextEdit *result)
- {
- QString text = "";
- QFile file(QFileDialog().getOpenFileName());
- if (file.open(QIODevice::ReadOnly))
- {
- QByteArray inpS = file.readAll();
- Inp->setText(QTextCodec::codecForName("Windows-1251")->toUnicode(inpS));
- result->setText("Считывание завершено");
- }
- else
- result->setText("Считывание не удалось");
- file.close();
- }
- void OutFile(QString text, QTextEdit *result)
- {
- QFile file(QFileDialog().getOpenFileName());
- if (file.open(QIODevice::WriteOnly))
- {
- QTextStream stream(&file);
- stream.setCodec("Windows-1251");
- stream << text;
- result->setText("Запись завершена");
- }
- else
- result->setText("Запись не удалась");
- file.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement