I have a text file associated with the std::fstream object.
std::fstream finout("text.txt"); Then from this file read. The read data is analyzed and some of them are deleted. Thus, the size of the output data can be reduced and it becomes necessary to truncate the file (or change its size). It seems completely silly and wasteful to create a new file and write the result into it. I would like to get a more efficient and easier way to achieve the desired result. The C language offers the functions ftruncate and chsize , however I use an object of class std::fstream .
PS On English sites I met similar questions, but I would like to know the opinion of the Russian-speaking audience.