Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++
how to reduce file size from mb to kb + by C++
i need source code
example
Posted 12-Nov-12 0:51am
arh66655
Comments
Maximilien at 12-Nov-12 10:41am
   
what file you want to reduce in size ? are you talking about file compression ?
pasztorpisti at 12-Nov-12 11:42am
   
POSIX: truncate()
Windows: SetEndOfFile()
To find examples use google! :-)
Mohibur Rashid at 13-Nov-12 3:37am
   
Don't post your comment or question as answer.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

That might be even NOT feasible.
Generally speaking, you need a compression library (you might select the proper one depending on the file and other requirements, e.g. should the compression be lossless ?)
Google[^] is your friend.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

1. Compressing. For non compressed content it generally works. You can use zlib.
2. Truncating, deleting, overwriting, rebuilding, cleaning. Not good if file contains important or sensitive information beyond the removing limits, or which can not be rebuilt, or generated from other contents as result of some kind of compilation.
3. shrinking, works for databases. In databases for performance considerations, data instead of real deleting, it is only marked as deleted. And in lots of cases the deleted information is much more than 90% of all the information contained in databases
4. Removing unnecesary and insensitive information from files in the places where you know what you are doing. Over internet sometimes it has much impact on traffic. For instance, removing ending tags, removing blanks and comments in scripts, renaming variables and functions to very short, symbolic names
Each method has lots of descriptions in google
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web04 | 2.8.140926.1 | Last Updated 13 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100