Mole is right. You're using C++ (the language) to build an application. Qt (the framework) enhances and provides pre-built functionality for your application.
For the C++ side of this question (which is really beyond the scope of these forums), you may have included fstream, but what namespace are you using? If you didn't tell the compiler you're pulling this functionality from the standard namespace ("using namespace std;" or "using std::ifstream;"--the latter being preferred), you'll need to declare "ifstream" as "std::ifstream".
These all do the same thing:
#include <fstream>
int main()
{
std::ifstream test("test.txt");
}
#include <fstream>
int main()
{
std::ifstream test("test.txt");
}
To copy to clipboard, switch view to plain text mode
#include <fstream>
using namespace std; // not preferred
int main()
{
ifstream test("test.txt");
}
#include <fstream>
using namespace std; // not preferred
int main()
{
ifstream test("test.txt");
}
To copy to clipboard, switch view to plain text mode
#include <fstream>
using std::ifstream;
int main()
{
ifstream test("test.txt");
}
#include <fstream>
using std::ifstream;
int main()
{
ifstream test("test.txt");
}
To copy to clipboard, switch view to plain text mode
Like I said, explaining this further is well beyond the scope of these forums.
From a Qt and QFile perspective, look at the docs for QFile. It's pretty easy to read a simple text file.
Bookmarks