c++ - how to delete the last line in a text file with 100M lines without having to rewrite the whole file? -


Let's say I actually have a large text file, say 100 million lines or 1 GB and I want to delete the last line. Is there any way to do 99.999 99 99 to rewrite the lines in the new file and do this to remove the old one? Suppose that the file is really big that the rewriting option is extremely expensive, what would you do to remove the last line? Thank you

You can open the file, as long as you have the first line delimiter (normally LF or CR / LF, depending on the platform), calculate the offset file at that point, and.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -