I am having some troubles in displaying the file permissions for a file!!! ...At the moment, all it does is display the integer format for file permissions, as all i am doing is:
Code:
printf("%d", fileattrib.st_mode);
which outputs the following (along with a few other lines of output code)
Code:
list of contents for: cwd
33261 1 root root 15343 Fri Nov 25 11:34:48 2005 myls
33188 1 root root 7735 Fri Nov 25 11:34:43 2005 myls.c
33188 1 root root 7131 Fri Nov 25 10:15:49 2005 myls.c~
16877 2 root root 4096 Fri Nov 25 11:31:09 2005 test1
I need to find out how to format it so that it outputs the following for the file permissions: (output from the propper ls command using -l switch)
Code:
total 36
-rwxr-xr-x 1 root root 15343 Nov 25 11:34 myls
-rw-r--r-- 1 root root 7735 Nov 25 11:34 myls.c
-rw-r--r-- 1 root root 7131 Nov 25 10:15 myls.c~
drwxr-xr-x 2 root root 4096 Nov 25 11:31 test1
Anyone know how to do this??? ...i have looked around on the net, some people say to use sperm, but this wont compile, so i am stuck!!!! Cheers, matt.