How to read a .gz file line-by-line in C++?

后端 未结 7 466
一整个雨季
一整个雨季 2020-12-29 23:08

I have 3 terabyte .gz file and want to read its uncompressed content line-by-line in a C++ program. As the file is quite huge, I want to avoid loading it completely in memor

相关标签:
7条回答
  • 2020-12-29 23:37

    You can't do that, because *.gz doesn't have "lines".

    If compressed data has newlines, you'll have to decompress it. You don't have to decompress all data at once, you know, you can do it in chunks, and send strings back to main program when you encounter newline characters. *.gz can be decompressed using zlib.

    0 讨论(0)
提交回复
热议问题