登录
首页 » 文件处理 » 文件合并算法将原来的文件统一当作二进制文件依次读取,然后依次写入一个新的二进制文件中,这样就完成了合并操作;反向操作就可以分割文件了…… 先自己定义一个通用的文...

文件合并算法将原来的文件统一当作二进制文件依次读取,然后依次写入一个新的二进制文件中,这样就完成了合并操作;反向操作就可以分割文件了…… 先自己定义一个通用的文...

于 2022-09-07 发布 文件大小:1.98 kB
0 50
下载积分: 2 下载次数: 2

代码说明:

文件合并算法将原来的文件统一当作二进制文件依次读取,然后依次写入一个新的二进制文件中,这样就完成了合并操作;反向操作就可以分割文件了…… 先自己定义一个通用的文件表示,比如说下列格式:文件名长度(4字节),文件名,文件长度(4字节),文件内容。然后新建一个文件,将你要加入的文件依次写进(当作二进制文件)。 至于还原吗,先读入合并后的文件,然后依次按以下过程还原文件:读入文件名长度,按此长度得到文件名,读入文件长度,按此长度得到文件的内容,写到磁盘上即可。具体的编程见以下例子: //以下为文件合并与分解函数,合并文件后的文件中各子文件顺序存放-document merging algorithm to the original document as a unified binary files were read, followed by the introduction of a new binary file, so it completed the merger operation; Contrarians can separate document ... their first definition of a common document, for instance, the following format : Name length (4 bytes), file name, file size (4 bytes), the contents of the file. Then a new document, you will be included in the document were included (as binary files). As for the reduction yet, dialer after the merger documents, to be followed by the following process Reduction Document : Reading into the file name length, according to the length of availability of documents, and read into the length of documents, accord

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • 696524资源总数
  • 103945会员总数
  • 46今日下载