./p4.x disk.img IPC~1.HTMshould copy the file named IPC~1.HTML from the root directory of the file system whose image is stored in disk.img. The files copied can be of any length.
For files not in the root directory, the path will be given in upper case with a forward slash (/) separating the directories. There should be no separator at the beginning of the path. For example,
./p4.x disk.img F2003/INDEX~1.HTMshould copy the INDEX~1.HTM file from the F2003 subdirectory of the image file to a file called INDEX~1.HTM in the current directory.
Here are copies of a few of the files to compare your output to; check the complete directory for other files to test.
mkdir /mnt/image mount -o loop ~knoppix/disk.img /mnt/imageand then browse the /mnt/image directory to see the contents of other files in the image.
Beware that the MS-DOS names may be different than the long file names. For example, the file processes.html would be called PROCES~1.HTM.
Read all relevant file system parameters from the boot sector -- don't assume parameters will be the same for every file system.
Under g++, short is the 16-bit integer type and char can be used for a 8-bit integer.
If you read data into a char array but you need to get a 16-bit or larger value, you will have to use some typecasts. For example if boot is an array of chars containing data read from the boot sector, then *((unsigned short *)(boot + 11)) will get the sector size (a 16-bit integer stored at offset 11 in the boot sector). An alternate method is to use a struct whose fields are aligned in the same way as the fields on disk. Beware, however, that g++ insists on aligning arrays and 16-bit (or larger) values on even offsets. See the example of reading the boot sector in read_boot.cpp.
Remember that normal directory entries won't have 15 (0F hex) as their attribute byte and won't have names that start with a null character (which is used to indicate the end of a directory) or character 229 (E5 hex) (which is used to mark deleted files).