If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Welcome to Qt Centre.

Qt Centre is a community site devoted to programming in C++ using the Qt framework. Over 90 percent of questions asked here gets answered. If you are looking for information about Qt related issue — register and post your question.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

I included <fstream>
and added using namespace std;
The file exists in the file and it contains 3 lines and each one of them has a string
And i tried both examples, using fstream and using QFile ( none of them work )

Re: fstream not working

Your fstream declaration in line 17 assumes that the file is in your current working directory. You might be surprised to learn that the working directory may not be what you think it is. Add a call to the static method QDir::currentPath() and see if the return QString contains what you think it should.

<=== The Great Pumpkin says ===>
Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.