简体   繁体   中英

tail a gzipped file in c++

I have multiple huge gzipped text files. I have to read the first and last n lines without loading the whole file into memory using head and tail like functions. For plain text files I use a tail like function similar to this answer .

However I want to avoid unzipping the files first. I have implemented a head like function working on gzipped files using a technique similar to this answer . But I fail to implement a tail like function that works with gzipped files.

Can't be done without running through the entire file and decompressing, at least in memory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM