-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsalvartextstring.cpp
More file actions
47 lines (40 loc) · 1.23 KB
/
salvartextstring.cpp
File metadata and controls
47 lines (40 loc) · 1.23 KB
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
#include "salvartextstring.h"
#include "iostream"
#include "fstream"
#include "list"
#include <QFile>
#include <QTextStream>
#include <QFileDevice>
#include <QTemporaryFile>
#include <gerararquivopdf.h>
#include <QDebug>
#include <QtSql>
using namespace std;
SalvarTextString::SalvarTextString( QObject* parent ) :
QObject( parent ) {};
void SalvarTextString::salvarArquivoText( string text ) {
ofstream outFile;
outFile.open( "/home/luizhenrique/Music/qt.txt" );
if ( !outFile ) {
cout << "Erro em Criar test.txt" << endl;
abort();
}
outFile << text;
outFile.close();
}
void SalvarTextString::salvarTextoQFile( QString texto ) {
QString local = qApp->applicationDirPath();
QFile file( local + "/TxtArquivo/bilhetes.txt" );
static QString printar;
printar.append( texto );
printar.append( "\n" );
printar.append( QString( "" ).leftJustified( 45, '_' ) );
printar.append( "\n" );
if ( file.open( QIODevice::WriteOnly ) ) {
file.write( printar.toUtf8() );
file.close();
qDebug() << "Arquivo TxtCriado Com Sucesso SalvarTextString::salvarTextoQFile";
}else {
qCritical() << "Arquivo Txt Nao Gerado SalvarTextString::salvarTextoQFile ";
}
}