Hi all,
Is it a good practice to use pure c++ code in Qt, I mean stuff like,
FILE *,std::string,fread,fclose. Can some body explain on this.
Thanks,
Raajesh
Printable View
Hi all,
Is it a good practice to use pure c++ code in Qt, I mean stuff like,
FILE *,std::string,fread,fclose. Can some body explain on this.
Thanks,
Raajesh
Most of the things you mentioned are actually C-originated (apart from std::string). Yes, you may use them if they fit your needs. Using QFile instead would give you some benefits, but if you feel confident with stdio.h, I don't see a reason not to use it.
I don't think so. You should use Qt's own facilities whenever feasible. For example using QFile and it's open() close() members and also Qt's own container classes. This will make your code easier to read by fellow Qt programmers.
The "pure" C/C++ tends to be at a much lower level, so it is harder to use. Also, most are from C, and have no objectness. How do you inherit from FILE?
In my opinion, when Qt gives you the same functionality that is easier to use with more features, then use the Qt class. Use QFile instead of FILE. QTextStream instead of iostream. QString instead of std::string. Etc.