"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

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like