将数据文件夹合并到一个文件中 [英] Merge Data Folder in one file

查看:76
本文介绍了将数据文件夹合并到一个文件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
假设我有一个名为"Client"的文件夹,并且该文件夹中有文件.例如:

Hey guys,
Suppose i have a folder called "Client" and files in the folder. For example:

Client<br />
<br />
Client/client.res<br />
<br />
Client/client.inc<br />
<br />
Client/client.txt.txt



我想将该文件夹合并为一个扩展名为没有其他人可以查看其中的文件"的文件.那有可能吗?如果我必须进行数据合并,该如何在C ++中进行呢?

谢谢



I want to merge the folder into one file with extension that no one else can view the files inside. Is that possible and if it is how? If i have to make a Data Merger how would i do it in c++?

Thanks

推荐答案

一个非常简单的建议:
A really simple suggestion:
1. Create the merge file.
2. write file name length (file1)
3. write the file name (file1)
4. write the file size (file1)
5. write the file content (file1)

通过步骤2..5对file2 ... fileN进行相同的操作.
您还可以在写入之前使用加密功能进行加密.
要读取合并的文件,请执行以下操作:

do the same for file2...fileN with the steps 2..5.
You can additional use an encryption function to encrypt before write.
To read the merged files:

1. Open the file.
2. Read the length of filename (file1)
3. Allocate the file name buffer and read the filename.
4. Read the file content length.
5. Read the file content and save it to the file (file1)

重复步骤2..5直到文件结尾.
问候.

Repeat the steps 2..5 til end of file.
Regards.


您可以定义自己的文件格式.
然后使用fopen,fread,fwrite,fclose等创建自己的文件.
you can difine your own file format.
and then use fopen, fread, fwrite, fclose and so on, to make your own file.


这篇关于将数据文件夹合并到一个文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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