No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
3 Posted Topics
You can seek the stream to the desired position and then read stream. Check this piece of code. // get size of file infile.seekg(0,ifstream::end); size=infile.tellg(); infile.seekg(0); Learn C++ here https://hackr.io/tutorials/learn-c-c-plus-plus All you need to do is to remember the position where you stopped reading infile, close outfile, open new outfile, …
First, your comparison function needs to be able to access the private member text of myclass. You could either make text public or add friend int cmp (const void *, const void*); in the class definition. Second, your comparison function is wrong. It takes pointers to the members of the …
Here is a pseudocode, 1. read the entire file into a vector 2. delete that file 3. create and write back the data to the file skipping the line that isn't required. Use std::getline() in a loop to read a line from the file. Learn C++ here https://hackr.io/tutorials/learn-c-c-plus-plus Load the …
The End.