FatFS, DWORD and f_size ?

Status
Not open for further replies.

bianchi77

Advanced Member level 4
Joined
Jun 11, 2009
Messages
1,313
Helped
21
Reputation
44
Reaction score
20
Trophy points
1,318
Location
California
Visit site
Activity points
9,442
Guys,

I tried to display f_size on FATFs,
I want to retrieve file size.

code :
Code:
Code:

DWORD   fsize;         /* File size */

 usart_pstr(" ");
            sprintf_P( &temp_buffer, PSTR("file size => u\n"), fno.fsize );
            usart_pstr( &temp_buffer );

but the result is different with I see on file size my computer

on uart :
Scan directory mp3
AIRSUP~2.MP3
file size => 15012
AIRSUP~3.MP3
file size => 63616
AIRSUP~4.MP3
file size => 29023

at my computer

Directory of G:\mp3

07/03/2014 12:39 PM <DIR> .
07/03/2014 12:39 PM <DIR> ..
08/12/2013 05:28 PM 3,881,636 airsupply3.mp3
08/12/2013 05:04 PM 8,255,616 airsupply2.mp3
08/12/2013 05:28 PM 4,354,399 airsupply1.mp3
3 File(s) 16,491,651 bytes
2 Dir(s) 978,108,416 bytes free

G:\mp3>


Any clues ?

thanks
 

sprintf_P() is no standard C function and "file size => u\n" contains no valid format specifier.
On a 16bit compiler %u is usually needed to print word data and %lu for dword.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…