CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

FAT12 & FAT16 implementation (problem:cant read the file

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
iseron



Joined: 21 Feb 2004
Posts: 12
Location: Santiago - Chile

View user's profile Send private message

FAT12 & FAT16 implementation (problem:cant read the file
PostPosted: Tue Mar 09, 2004 2:49 pm     Reply with quote

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

View user's profile Send private message Visit poster's website MSN Messenger ICQ Number

Re: FAT12 & FAT16 implementation (problem:cant read the
PostPosted: Tue Mar 09, 2004 5:00 pm     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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