How to write a existing bigger binary file into small/compact binary file in C.
-
I have a binary file of size 3GB. I want to reduce the size using some coding in C to write another binary file. Please suggest/provide a way to write compact binary file. TO read this file i need to use C#. Thanks, Sachin
WinZip(3GB_Filename, 2GB_Filename);
? :) Seriously, it depends on what is contained in the 3GB binary file. Is it even compressible? If it contains lots of NULLS, for example, change the NULL bytes to a single NULL followed by a count of how many there are. A string of 10 NULLS would turn into a single NULL and a byte with the number 10 in it, saving 8 bytes. Reading the file in, you would simply reverse the process. 1,2,3,4,5,0,0,0,0,0,0,0,0,0,0,1,2,3,a,b,c,0,0,0,0,d,e,0,f,ff (30 bytes) Becomes 1,2,3,4,5,0,a,1,2,3,a,b,c,0,4,d,e,0,1,f,ff (21 bytes) Alternatively, implement one of the Open Source Zip and Unzip routines in your C and C# code, as appropriate.
Gary
-
I have a binary file of size 3GB. I want to reduce the size using some coding in C to write another binary file. Please suggest/provide a way to write compact binary file. TO read this file i need to use C#. Thanks, Sachin
-
I have a binary file of size 3GB. I want to reduce the size using some coding in C to write another binary file. Please suggest/provide a way to write compact binary file. TO read this file i need to use C#. Thanks, Sachin
-
I have a binary file of size 3GB. I want to reduce the size using some coding in C to write another binary file. Please suggest/provide a way to write compact binary file. TO read this file i need to use C#. Thanks, Sachin
Hope below links will help you: fastest c++ file compression library available[^] Cabinet File (*.CAB) Compression and Extraction[^]
-- "Programming is an art that fights back!"