|
|
View previous topic :: View next topic |
Author |
Message |
iseron
Joined: 21 Feb 2004 Posts: 12 Location: Santiago - Chile
|
FAT12 & FAT16 implementation (problem:cant read the file |
Posted: Tue Mar 09, 2004 2:49 pm |
|
|
Hello.
Now i'm developing a routine to create a big .TXT file, in a datalogger mode, what use all the space available in a compact flash device.
My way to do the datalogger, is create a .TXT file then fill with data in the data sectors in continuous order.
So I'll take the FAT information from the sector 0 ( boot sector). With this i have cluster size, number of Fat copies, size in sector of each fat and the root directory size.
With this info, ill create an archive, pointing to cluster 2, with the size of the CF (actually a little less due the space ocupied by the fat structure).
Then, write a FAT with the secuential clusters until reach the size of this archive, finishing the FAT with an EOF or FFFFh.
At last the data begins to be saved in the data sector.
My big-only problem is:
I can see the file in windows but when i try to open a message of error i only have. I can't open the file.
With a program like WINHEX i can open the compactflash and see all the operations work correctly and teh data its saved.
Question:
The fat, need like a checksum or something like that for create a file which can be readed?
Anybody can explain me the typical errors developing this kind of software?
PS: ill read all the specs from the microsof paper and this very clear web site.FAT12 & FAT 16 ----> http://www.maverick-os.dk/FileSystemFormats/FAT12_FileSystem.html
Thanks!
Ignacio. |
|
|
Pete Smith
Joined: 17 Sep 2003 Posts: 55 Location: Chester, UK
|
Re: FAT12 & FAT16 implementation (problem:cant read the |
Posted: Tue Mar 09, 2004 5:00 pm |
|
|
iseron wrote: | Hello.
Now i'm developing a routine to create a big .TXT file, in a datalogger mode, what use all the space available in a compact flash device.
My way to do the datalogger, is create a .TXT file then fill with data in the data sectors in continuous order.
So I'll take the FAT information from the sector 0 ( boot sector). With this i have cluster size, number of Fat copies, size in sector of each fat and the root directory size.
With this info, ill create an archive, pointing to cluster 2, with the size of the CF (actually a little less due the space ocupied by the fat structure).
Then, write a FAT with the secuential clusters until reach the size of this archive, finishing the FAT with an EOF or FFFFh.
At last the data begins to be saved in the data sector.
My big-only problem is:
I can see the file in windows but when i try to open a message of error i only have. I can't open the file.
With a program like WINHEX i can open the compactflash and see all the operations work correctly and teh data its saved.
Question:
The fat, need like a checksum or something like that for create a file which can be readed?
Anybody can explain me the typical errors developing this kind of software?
PS: ill read all the specs from the microsof paper and this very clear web site.FAT12 & FAT 16 ----> http://www.maverick-os.dk/FileSystemFormats/FAT12_FileSystem.html
Thanks!
Ignacio. |
Are you updating the entry in the _directory_ table too?
It's one thing making sure the FATs are OK (are you making sure you update the primary and secondary FATs, assuming you have 2 of them?), but don't forget that you have to tell the file that it is also the correct size.
I know it's an obvious question, but it has to be asked!
Nice URL detailing the FAT layout BTW! Better than the one I've used.
Pete. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|