How can I fill an array with files?
How can I fill an array with files?
File names or file contents?Originally posted by TeQno
How can I fill an array with files?
a file which encapsulates lets say 3 files
MyFile([file1][file2][file3])
Last edited by TeQno; 07-08-2003 at 02:31 AM.
First you say an array of files, then you say a file encapsulating many files. What EXACTLY do you want?
[email protected]
Microsoft Visual Studio .NET 2003 Enterprise Architect
Windows XP Pro
Code Tags
Programming FAQ
Tutorials
an array of files... an array not filled with characters but with files.
so it encapsulates a few files....
i dont know if its possible or how im just curious
Do you mean something like this?
That sort of thing would allow you to load every byte from a file into a large BYTE array, (hopefully) allocated somewhere other than the local stack, then access that data as you please.Code:FARRAY fArray[5]; //short for filearray LoadFileIntoArray(&fArray,0,"filename.ext"); LoadFileIntoArray(&fArray,1,"filename2.ext"); //etc... //then later... int dispFile(const FARRAY fArray,int nIndex) { cout << (char *)(fArray[nIndex].data); return 0; }
[email protected]
Microsoft Visual Studio .NET 2003 Enterprise Architect
Windows XP Pro
Code Tags
Programming FAQ
Tutorials
What are you trying to do? There should be no need to store the entire contents of multiple files in some huge multi-dimensional array.
Please be a bit more descriptive.
well think of winzip or the likes, isnt a zip file an array of files?
(or am i totally off here.. if I am please say so )
Without any compression, I could think of an easy way to do this. Create a structure for a file that will include a header, and x number of data blocks. The header should include the details of each file contained in the overall file, including the offset, length, filename, etcetera. You can then use whatever file ouputing technique you want. Eg: (file contents)
Something like that should suffice.Code:[HEADER] ["blah.dll",120,2500] ["readme.txt",2621,360] [/HEADER] blah.dll contents output right here, at offset 120 readme.txt contents output here, at offset 2621
[email protected]
Microsoft Visual Studio .NET 2003 Enterprise Architect
Windows XP Pro
Code Tags
Programming FAQ
Tutorials
Zip files are much more than just an array of files. There is quite a lot of information in a zip file. For more information on its structure and possibly how to code an unzip function, go to www.wotsit.org
yes i know its quite more then an array of files.. i was just giving an example..