Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: khouidmi habib
  Where is khouidmi habib?
 khouidmi habib
 To: Pete Sass
  Where is Pete Sass?
 Marathon, Ontario
 Pete Sass
Subject: RE: .Dat file
Thread ID: 21992 Message ID: 22032 # Views: 8 # Ratings: 0
Version: Visual FoxPro 6 Category: General VFP Topics
Date: Monday, April 07, 2003 8:13:27 PM         

> > hi all,
> > any one can tell me what is .dat file and how can we use it or access to it, ihave seen an application use a dat file to translate from a language to other. ???
> Hi From Pete,
> Description
> =======
> A DAT file is a type of archive used to store many small files. DAT archives are a more updated version of the FAR format used in games such as The Sims™, with the biggest difference being the addition of file compression. A DAT archive works by taking many small files and joining them together to create a large file which is easier to update and maintain.
> File Structure
> ========
> The DAT archive is a very simple structure to understand and program. DAT files are made up of 4 main parts - Header, Directory, Entries, and Files. Below is a brief description of each part and how you can read the DAT archive.
> Header
> ====
> The file header is located at the very start of the DAT file and provides important information relating to the archive.
> ================
> File Tag 8 bytes These first 8 bytes of the DAT file are used to identify the file as being a FAR/DAT archive. Because this code is read by programs as a means of identification, it must not be altered. For all DAT and FAR files, the file tag is the following string of text, "FAR!byAZ" which tells us and the program that is it a true FAR/DAT archive.
> Version 4 bytes These next 4 bytes tell the program what version is being used.
> Directory Offset 4 bytes This number tells the program where the directory begins in the archive. Without this, the program wouldn't be able to find the right files.
> File Data X bytes All the files in the archive are stored here, one after the other. The only way to split these file apart is to get their details from the file directory.
> Directory X bytes The directory is a list of all the files stored in the archive, and some properties about them. The directory is located at the end of each DAT file. SEE BELOW
> Directory
> ======
> The directory lists all the files which are stored in the archive. You can find the location of the directory through the file header described above.
> ================
> Number of Entries 4 bytes The first 4 bytes of the directory tells you how many files are stored in the archive. This can be used as a checking mechanism to ensure you have all the files.
> Entries X bytes This describes the files and their properties to the program for interpretation. SEE BELOW
> Entries
> ====
> Each directory entry is listed here in alphabetical order. By interpereting this information, a program is able to find and extract the specific file you want.
> ================
> Raw File Size 4 bytes This number indicates the number of bytes the file takes up when it is uncompressed.
> Compressed File Size 4 bytes This number indicates the number of bytes used when the ile is compressed. This is also the number of bytes the file takes up in the DAT archive.
> Data Offset 4 bytes A number which tells the program where the file is located in the archive. To find the file, all you need to do is go to this spot and take all the data up to the compressed size of the file.
> Unknown/Unused 2 bytes There are 2 bytes here which don't seem to indicate anything at all. These 2 bytes are always the number 1 in DAT archives.
> Filename Length 2 bytes This number indicates the length of the filename. DAT files do not store different directories in the same file, only files in the one directory can be stored.
> File Type 4 bytes These 4 byte tell the program what kind of file it is. This is used to determine whether the file has been compressed or not. These bytes return a number which represents a certain file type. SEE BELOW
> File ID 4 bytes Each file of each type is given a unique ID number starting from the number 1. These ID numbers must be unique across all DAT archives, not just the archive which stores the file. Each file type has its own set of IDs, so you can have a BMP file number 1 and a JPG file number 1, but you cannot have two BMP number 1's.
> Filename X bytes This string is the filename of the entry. This is obviously used to ensure you have found the right file.
> File Type Codes
> ==========
> File type coding is a new addition to the DAT file format. Each type of file in the archive is given a number according to the type of file it is. Below is the list of file types and their codes.
> =================
> 1 *.BMP Bitmap image Yes
> 2 *.TGA Targa image Yes
> 3 *.???
> 4 *.???
> 5 *.???
> 6 *.???
> 7 *.ANIM Animation file Yes
> 8 *.???
> 9 *.MESH Mesh file Yes
> 10 *.???
> 11 *.BND Binding file No
> 12 *.APR Appearance file No
> 13 *.OTF Outfit file No
> 14 *.PNG Image Yes (?)
> 15 *.PO Purchasable objects No
> 16 *.COL Collection file Yes
> 17 *.???
> 18 *.HAG Group file Yes
> 19 *.???
> 20 *.JPG JPEG image No
> Dat files are used a lot for backup software such as ArcServe to store backup archive information
> in large server backup senarios.
> Pete from the Great White North. (Only in Canada, ay.) Over and Out ...

can you show me a small exemple how to create a dat file please?


.Dat file Posted by jean albert @ 4/7/2003 10:17:44 AM
RE: .Dat file Posted by Pete Sass @ 4/7/2003 2:28:36 PM
RE: .Dat file Posted by jean albert @ 4/7/2003 8:13:27 PM