Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"QIODevice::write: device not open" when file is open

Tags:

c++

qt

When I compile my program I get the error message "QIODevice::write: device not open" this program worked on my old computer but for some reason its not working on my new computer. Any insight on how to fix this error would be greatly appreciated, thanks.

file.open(QIODevice::Append);
file2.open(QIODevice::Append);

QTextStream stream(&file); //stream of information
QTextStream stream2(&file2);

//write to file
//code continued here, deleted to post here... stream << whatever, stream2 << whatever whatever...

//end stream
stream << endl;
stream2 << endl;

//close file
file.close();
file2.close();
like image 546
Brandan B Avatar asked Mar 17 '23 05:03

Brandan B


1 Answers

The problem was I was creating the file in a place that did not exist on this computer changed the location to create the folder and it fixed it.

like image 69
Brandan B Avatar answered Mar 23 '23 07:03

Brandan B