Questions tagged [qtextstream]

The QTextStream class provides a convenient interface for reading and writing text.

QTextStream can operate on a QIODevice, a QByteArray or a QString. Using QTextStream's streaming operators, you can conveniently read and write words, lines and numbers. For generating text, QTextStream supports formatting options for field padding and alignment, and formatting of numbers.

The official Qt documentation can be found here for Qt 4.8 and here for Qt 5.

90 questions
1
vote
1 answer

QTextStream stdin readline not pausing for input

Here is a very simple application to illustrate the problem I am having. #include int main() { QTextStream cin(stdin); QTextStream cout(stdout); QString test; cout << "Enter a value: "; cout.flush(); cin >>…
Leon
  • 12,013
  • 5
  • 36
  • 59
1
vote
1 answer

Qt: file read does not work

I want to read a file and to put it in a Qstring but the file doesn't be read I have searched for many sample in google but it doesn't work... I want read the file... using namespace std; int main(int argc, char *argv[]) { QApplication…
eci_small
  • 13
  • 2
1
vote
1 answer

An issue with QFile class nesting

The problem occurs when I define a struct like the following one struct TInputData { QString filename; QFile file; QTextStream stream; }; then I put this into a QVector container as follows: QVector
niebelung
  • 127
  • 8
1
vote
1 answer

QTextStream accentuation codification

I learning Qt, with Qt5.1 and I'm have coding problems in accentuation. I write programs with outputs in Portuguese and always have to use accents. The problem can be demonstrated in the following code: \#include < QDebug> \#include <…
0
votes
1 answer

QTextStream Maniuplation

I'm opening a file and getting a QTextStream of it. I am then reading the stream line by line using readLine(). When the line matches a certain string, I need to replace it with another string. I need the behaviour to be that the line is completely…
oggmonster
  • 4,672
  • 10
  • 51
  • 73
0
votes
1 answer

Add node to Existing Root Element

I am trying to add child node to an existing root node using C++ QDOM element but unsuccessful. My xml would be like this. and I am trying to add so it could be like…
0
votes
1 answer

C++ Qt5 : How to unread a character to QTextStream?

I'm parsing tokens with QTextStream to extract characters one by one calling stream >> ch. I wonder if there is a way to get a character back to stream, so it will be the next character read from it. stream << ch always adds one character to the end…
Quasy
  • 29
  • 5
0
votes
1 answer

contineously writing to text file and deleting old data after fixed timer

In Qt I'm writing continuously to text file, so my file size increasing but i want kept size limit so need to delete old data in text file. I calculating file size in MB for every minute if file size is greater than 600MB I used QFile::resize(100);…
0
votes
0 answers

How to use setAutoDetectUnicode and setGenerateByteOrderMark with QTextStream

I want to set an encode and BOM to a file. I want to get a flag of encoding and BOM I set when I saved a file. But both of the two are not saved. What is wrong with my coding? I don't know about the Encoding and BOM well, how should I understand…
Haru
  • 1,884
  • 2
  • 12
  • 30
0
votes
0 answers

Display data from a text file into QAbstractTableModel

I have data that is stored in the a text file and I want to load the lines of the text file into a table model. The class that is derived from QAbstractTableModel uses the following functions: QVariant DataTableModel::headerData(int section,…
taathy
  • 155
  • 1
  • 1
  • 9
0
votes
2 answers

How to write data to mutiple QFiles

I am trying to add a line to the file every time i receive data, and if the number of lines exceed 10 lines, create new files to store the data until create 5 files, but i encoutered a problem, that is the application will crash at the 56th line :…
iwtbae
  • 11
  • 1
0
votes
0 answers

The inferior stopped because it received a signal from the Operating System. Signal name :SIGSEGV Signal meaning :Segmentation fault

pleeeease help. I am trying to create a GUI that simply returns the users input back to the console output. I have the GUI and regular expressions working but when i click add my program crashes. i have run debugging and get the error in the subject…
0
votes
1 answer

Writing QString to Excel produce extra Tab?

After working with my initial Data.CSV, I want to save it again as Data.CSV, while that works already amazingly well, it somehow writes in the wrong Column when I open it in Excel. Somehow wrongly written Data: That is how I write it to the…
Deto24
  • 63
  • 5
0
votes
1 answer

Convert QTextStream to QByteArray

I need to convert a QTextStream to a QByteArray, and then back again. I found an example of QTextStream -> QByteArray by constructing a QTextStream(QBytearray) and then any text < < to the stream ends up in the bytearray. But how about the other…
TSG
  • 4,242
  • 9
  • 61
  • 121
0
votes
1 answer

Creating text file with Qt Creator on embedded Linux

I'm trying to create a text file by clicking on a button as following code, but I'm not getting. QString local = "/local/flash/root"; QString name = " ProductionOrder.txt"; void page1000::on_pushButton_3_clicked() { QFile…