Questions tagged [qfile]

A QFile is a class from the Qt Toolkit which provides an interface for reading from and writing to files.

QFile is an I/O device for reading and writing text and binary files and resources. A QFile may be used by itself or, more conveniently, with a QTextStream or QDataStream.

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

305 questions
0
votes
1 answer

How to rewrite a letter in a file containing multiple lines in Qt?

I have a file which contains numerous lines each being a sentence in english. What my program has to do is: I have to change a letter in one of those lines. File looks like this: he has wild dreams he walks into the forest alone he transforms…
-1
votes
1 answer

Access to .h and .cpp files

I am trying to access .h and .cpp files in a selected folder. My goal is to find and print on MainWindow how many lines in .h and .cpp files. In my code, there is no problem to access to selected folder. But for example, what if a .txt file is in…
Efe Şafak
  • 25
  • 4
-1
votes
2 answers

Infinite cycle due to QTextStream

So, I get infinite cycle while trying to read lines from file (line by line). I was trying to use do{}while(); cycle like that: QTextStream stream(stdin); QString line; do { line = stream.readLine(); } while (!line.isNull()); but I get empty…
bogdyname
  • 358
  • 2
  • 10
-1
votes
1 answer

Invalid Operands to Binary Conversion for QTextStream

I need to know about the conversion for QTextStream to a bool variable. Have a look at my code : QFile file(SOME FILENAME); if(!file.open(QIODevice::ReadOnly | QIODevice::Text)) qDebug() << "FILE COULD NOT BE OPENED"; QTextStream…
Satish Joshi
  • 71
  • 1
  • 7
-1
votes
1 answer

QFileDialog Crashes application on deleting multiple folders

Below is the code, Header File QtGuiApplication1.h #pragma once #include #include "ui_QtGuiApplication1.h" class QtGuiApplication1 : public QMainWindow { Q_OBJECT public: QtGuiApplication1(QWidget *parent =…
sk110
  • 77
  • 2
  • 9
-1
votes
1 answer

I want to view the original Image

I want to view the original Image file. But all Images are converted into the spotted,corrupted image. It seems that the previous image is not equal to the behind image. Please change the image size in the QImage's constructor into your arbitrary…
Haru
  • 1,884
  • 2
  • 12
  • 30
-1
votes
1 answer

QFile has incomplete type

Trying to create a new QFile with QFile filename(file); I keep getting the following error error: variable has incomplete type 'SampleClass::QFile' note: forward declaration of 'SampleClass::QFile class QFile;' I looked it up and I have tried…
Josh3248
  • 3
  • 5
-1
votes
2 answers

How to create an array of integers from a file, using QFile, c++

Im using qtCreator I have a file `file.txt` like: n a1 a2 a3.. an b1 b2 b3.. bn n1 n2 n3.. nn n is the size of the matrix. I need to create an array from dat file but using QFile, not ifstream.
-1
votes
1 answer

How can I pass arguments off a QFile to other function on QT?

I have this code, and i want to pass the directory off the file selected on the "void MainWindow::on_pushButton_2_clicked() " function to the " char* videoName ". How can I do it? I dont know how to do it, please help me!!!!1 #include…
-1
votes
1 answer

I can't save .txt file with QFileDialog, C++ QT

This is my code: void MainWindow::save(){ QString fileName = QFileDialog::getSaveFileName(this, tr("Save Text File"), path, tr("Text Files (*.txt)")); if (fileName != "") { QFileInfo info(fileName); path =…
KFGC
  • 1
  • 4
-1
votes
1 answer

How can I store the content of a *.css file (text file) with addidional information in a new file?

I have a textfile (*.css Cascading Style Sheets) file, which is a plain text. Then I have additional program information, just some double and int values, which has noithing to do with the text file directly. I would like to store that state in a…
Ralf Wickum
  • 2,850
  • 9
  • 55
  • 103
-1
votes
1 answer

Why is the QByteArray read from a file smaller than the newly downloaded QByteArray?

I am attempting to compare a QByteArray of an already saved html file with a QByteArray that was just downloaded. I have to convert the QString of the file's contents to QByteArray in order to compare them (or vice versa) and comparing bytes seems…
seang96
  • 61
  • 1
  • 11
-1
votes
1 answer

qt check if file exists in a directory, if it doesn't prompt the user for its location, then copy the file to the program working directory

I have a program who's working directory is ~/Library/Application Support/MyApp, it looks here for the config.cfg and log files. The program needs a map file called MP512-Map.map. It looks in this directory to load it. When the program is first run…
Mitchell D
  • 465
  • 8
  • 24
-1
votes
1 answer

Setting the name of a text file to a variable in qt

I'm exporting data to a text file in qt every time a run a code. With my current code that file is overwritten each time. My question is how can I set the title to be a variable eg pulse_freq, this way new files will be created based on my variable…
Duanne
  • 137
  • 1
  • 3
  • 13
-1
votes
1 answer

Fast Forward,rewind for QAudioOutput

Hey am playing an audio file using QAudioOutput I need to implement a slider with which u can seek a track at a particular time.
Hemapriya
  • 19
  • 3
1 2 3
20
21