"Qiodevice: :Write: Device Not Open" When File Is Open

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();
2

1 Answer

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Chloe Bennett

Chloe Bennett

Culture, Media & Entertainment Columnist

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.

Share this article
Twitter Facebook Pinterest