FuzZy2006
November 3rd, 2006, 05:06 PM
which is the c++ code that would do the same thing that the ls -l command does?
supirman
November 3rd, 2006, 07:00 PM
glibc filesystem interface (http://www.gnu.org/software/libc/manual/html_node/File-System-Interface.html#File-System-Interface)
amo-ej1
November 5th, 2006, 01:12 PM
- run strace ls -al
- and look at the output:
fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7c63000
write(1, "000_0198.jpg\t cv\t\t\t\t\t "..., 139000_0198.jpg
Prior to writing the output it did a call to 'fstat64'
- gather info on fstat:
e@lap:~$ whatis fstat
fstat (2) - get file status
And now the most vital part:
man fstat
And now it is only a matter of formatting. i wish everything in life was this easy ;)
Powered by vBulletin® Version 4.2.2 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.