I just started learning linux/C, i just want to show the names of all the files of the directories given in argument, and their access permissions by using stat() which causes some problems. It actually shows the correct name/mode of all the files included in the current directory, but for the other directories given in argument, it does give the
Tag: stat
Why is stat::st_size 0 for devices but at the same time lseek defines the device size correctly?
I noticed that when I query the size of a device using open + lseek, everything is OK, but when I stat the device, I get zero instead of the real device size. The device is clean without any file system and the first bytes of device start with some text like “1234567890ABC”. What is wrong? The code: Output: If
Usage of lstat / stat from the linux kernel?
I’m hoping someone can fact check my assumptions on the question “Can lstat and/or stat be called form the Linux kernel 3.10.0 in Centos 7. I’ve been searching and reading as much as I can find and have only been able to confuse myself. I can’t tell if the examples I am finding are available to kernel space or user
How to display modified date time with ‘find’ command?
With a find command, I can display directories names with multiple levels. The following command display all directories under /var path with a depth of 2: The result shows: With a stat command, I can find the modified date time: The result is: Is there a way to combine the two commands so that directories will be listed with modified