Writting from a spinBox to a file .txt
-
Hello guys,
I hope I wrote in the good section.
Here is my problem, I want to write the value of a spinBox into a file .txt BUT what I actually get into my file is probably the address of the value (hexadecimal). I don't know what is wrong with my code (if it is when I get the value from the spinBox or if it is when I write it into the file)
Here is the part of the code :
@#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "secondwindow.h"MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);int nombre=ui->spinBox->value(); texte=QString::number(nombre);
}
MainWindow::~MainWindow()
{
delete ui;
}void MainWindow::on_pushButton_clicked()
{
QFile file("out.txt");
if (!file.open(QIODevice::WriteOnly))
return;QTextStream out(&file); out << nombre; second = new secondwindow(this); second->show();
}
@Thank you a lot for your answer,
Arnaud -
Hi guys again,
I was stupid, I fixed this problem by myself. Stupid mistake.
See ya
-
Glad you fixed it. :) Sometimes I find just asking or posting about something kicks off the answer in my brain, lol.
In order to help anyone else out that might view this looking for help could your post your fix for it and mark it as [SOLVED] in the title?