Click here to Skip to main content
16,019,152 members
Please Sign up or sign in to vote.
3.50/5 (2 votes)
See more:
File consists structure like header, archive files which are individually compressed, File Table.
File1.bin
[
C++
struct FileHeader
{
crc---crc of file1.bin
headersize--size of File1.bin
Version-version File1.bin
FileCount--number of files FilesArchived
tableoffset---byte offset FielTable
Julian Date--databse begindate

}

FilesArchived--- .pdf and .bmp(individually compresed)

FileTable -- index of files in FilesArchived
Fileoffset--absolute offset of pdf file in File1.bin
compressed FileSize--- compressed size of file in FileArchive
OriginalFileSize ---uncompressed size of file in archive
flag1
flag2

From the above structure of the File1.bin

I have to extract the data from File1.bin and create the newFile1.bin and structure to be like mentioned below

newFile1.bin

C++
structure newFileheader
{
 Size of header
numofFruits
fruitbinfilename
version
begindate
}

Filename(pdf files)
Fileoffset
Orginal file size
Compressedfile size
Flag1
Flag2
Fruitfilename.

From above newFile1.bin
I have to extract the Fruitbinfilename(Fruit1.bin)

Format looks like

Fruit1.bin .... Fruit2.bin… Fruit3.bin ……..…. FruitN.bin
Pdf file1 ….. Pdf file1 ….Pdf file1 …… …….Pdf fileN
Pdf file2….. Pdf file2 …. Pdf file2 …………..Pdf fileN
Pdf file3 ….. Pdf file3 …. Pdf file3………….. Pdf fileN
.. ..
..
..
..
..
Pdf fileN ….. Pdf fileN …. Pdf fileN………….. Pdf fileN


Here we get the fruit data from Fruit.dbf files which is meta data.


In the Fruit.dbf file there will be associate mapping to pdf filename in that.</pre>



please tell me how to read and write in c++ or vc++ to generate newFile1.bin->fruit.bin from File1.bin
Posted
Updated 14-Jul-12 4:34am
v2
Comments
[no name] 15-Jul-12 5:59am    
Which bit are you having difficulty with?
JOYKAIGA1 17-Jul-12 11:26am    
for each pdf file there is associated fruit mapping ,like this around 1 lakh pdf files are there and 50 fruits are there.these are meta data stored in dbf files. tell me how to write into a file with this associating fruits ?

1 solution

Start here[^] and check the entries for CreateFile(), ReadFile(), WriteFile() and SetFilePointer(). That should cover the basics of what you need.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 14-Jul-12 23:48pm    
Agree. My 5.
--SA
JOYKAIGA1 17-Jul-12 11:25am    
for each pdf file there is associated fruit mapping ,liek this around 1 lakh pdf files are there and 50 fruits are there.these are meta data stored in dbf files.

tell me how to write into a file with this associating fruits ?
JOYKAIGA1 17-Jul-12 11:27am    
Also tell me in File1.bin ,we have archive files(pdf files) individually compressed.how to read and store the file data and contents in a buffer or separate directory in a order ?
Richard MacCutchan 17-Jul-12 11:35am    
Sorry but neither of these comments make sense; what is "fruit mapping"? I have given you links to the API functions for reading and writing files, but it is up to you to decide where to write the structures and other content.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900