5

how to use c get size of a file which is created using dd command

view full story
linux-howto

http://stackoverflow.com – i create a file using dd command like this: dd if=/dev/zero of=1g.dd bs=1M count=512 seek=512 when i run command ls 1g.dd, its size is 1G, run du 1g.dd, it's 512M. there is a struct stat in c library to read file size, but it can only read out that 1G size, now how can i get that 512M size which is the real size of that file? now the only way i know is to parse shell command du's output. can i read out the size from the file directly? (HowTos)