I have a log_date.txt
file that I wrote some C code around to parse and reduce it. I parse it by using fgets( buffer, 1024, fp )
to read each line into my buffer character array. Everything is based around a text file with newlines, and I read text line by line.
In keeping these logs over time, each one has had gzip -9
done on it resulting in log_20200101.txt.gz
Imagine having a file saved every day and when running my C code to read any chosen one you would have to manually do a gunzip log_20200101.txt.gz
beforehand, and when done re-gzip it. Is there a way in C to do an fopen
and continue to use all my fgets()
but have it happen on a .gz
file?