File IO Between QFile And std fstream

The article show demoes about use ifstream to read file written by qfile and use qfile to read file written by ofstream. Use ifstream to read file written by QFile #include <QCoreApplication> #include <QString> #include <QFile> #include <iostream> #include <fstream> int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); QString Read more…

C++ : Create Same BasicIO Functions For Cross-platform Compatibility

I write a few file IO functions which are used in windows and mac os x. bool CopyAFile(const std::string inFile, const std::string outFile); bool RemoveFile(const std::string filePath); void RemoveDir(const std::string folderPath); void MoveAFile(const std::string oldFile, const std::string newFile); void CheckFolderExist(const std::string folderPath); bool FileExists( const std::string path ); void HandleLastSlash( Read more…

Add Subdirectory In CMake Project

Add subdirectories and use VTK library and Qt in my projects. The file structure looks like the following image. projectB generates lib and dll files which will be used by projectA. projectA show a window and print message from Base class in projectB. The file CMakeLists.txt in the root directionary Read more…

C++ Exercises: Data Structure II

Exercises: 232. Implement Queue using Stacks Implement a first in first out (FIFO) queue using only two stacks. The implemented queue should support all the functions of a normal queue (push, peek, pop, and empty). Solution: take advantage of the features of both stacks #include <iostream> #include <set> #include <vector> #include <algorithm> #include <stack> Read more…

Content Summary
: Input your strings, the tool can get a brief summary of the content for you.

X