如何通过C ++将文件大小从mb减小到kb + [英] how to reduce file size from mb to kb + by C++

查看:159
本文介绍了如何通过C ++将文件大小从mb减小到kb +的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何通过C ++将文件大小从mb减小到kb + 我需要源代码
example

how to reduce file size from mb to kb + by C++
i need source code
example

推荐答案

那可能甚至不可行.
一般来说,您需要一个压缩库(您可以根据文件和其他要求选择合适的压缩库,例如,压缩是否应无损?)
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.


1.压缩.对于非压缩内容,通常可以使用.您可以使用zlib.
2.截断,删除,覆盖,重建,清理.如果文件包含超出删除限制的重要或敏感信息,或者由于某种编译而无法重建或从其他内容生成该信息,则不好.
3.缩小,适用于数据库.在出于性能考虑的数据库中,数据(而不是真正的删除)仅标记为已删除.而且在很多情况下,已删除的信息远远超过数据库中包含的所有信息的90%
4.从您知道自己在做什么的位置的文件中删除不必要和不敏感的信息.通过互联网有时会对流量产生很大影响.例如,删除结束标记,删除脚本中的空格和注释,将变量和函数重命名为非常短的符号名称
每种方法在google中都有很多描述
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


这篇关于如何通过C ++将文件大小从mb减小到kb +的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆