I am creating then writing to a text file using QTextStream. The problem is that the file is created if I build the application and run it from folder it creates, but if I run it from inside Qt in either release or debug mode it doesn't create the file. Does anyone have any suggestions? I am using a Macbook Pro.

1

There are 1 answers

1
Boris Dalstein On BEST ANSWER

You probably used a relative path, and inside QtCreator the "current directory" from where the executable is ran is not necessarily the directory where the executable is.

Try:

qDebug() << QDir::currentPath();

It will tell you where you should expect your file to be written.