-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.cpp
executable file
·48 lines (42 loc) · 1.09 KB
/
config.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "config.h"
#include "ui_config.h"
#include <fstream>
#include <iostream>
using namespace std;
config::config(QWidget *parent) :
QDialog(parent),
ui(new Ui::config)
{
ui->setupUi(this);
string maxLinha;
fstream arqGr,arqPl;
arqGr.open("gramat.ftl",ios_base::in);
if(!arqGr.is_open())
arqGr.open("gramat.ftl",ios_base::out);
arqPl.open("palav.ftl",ios_base::in);
if(!arqPl.is_open())
arqPl.open("palav.ftl",ios_base::out);
while(!arqGr.eof())
{
getline(arqGr,maxLinha);
this->ui->gramat->append(QString(maxLinha.c_str()));
}
while(!arqPl.eof())
{
getline(arqPl,maxLinha);
this->ui->palavr->append(QString(maxLinha.c_str()));
}
arqGr.close();
arqPl.close();
}
config::~config()
{
ofstream arqGr,arqPl;
arqGr.open("gramat.ftl");
arqGr << this->ui->gramat->toPlainText().toStdString();
arqGr.close();
arqPl.open("palav.ftl");
arqPl << this->ui->palavr->toPlainText().toStdString();
arqPl.close();
delete ui;
}