Hi. If anyone can help me with ls –l I appreciate that. I've written program in c to stimulate ls -l.
it's works well except the link. I need to print out the line like this
lrwxrwxrwx 1 admin admin 11 Feb 27 19:08 figC.18 -> ipc/fifo1.c.
but it’s just print lrwxrwxrwx 1 admin admin 11 Feb 27 19:08 figC.18. I need to make my program print the link also.
Thanks for your help
•S_ISBLK(mode) -- Is this a block special file? (usually a block-based device of some sort)
•S_ISCHR(mode) -- Is this a character special file? (again, usually a character-based device of some sort)
•S_ISDIR(mode) -- Is this a directory?
•S_ISFIFO(mode) -- Is this a pipe or FIFO special file? •S_ISLNK(mode) -- Is this a symbolic link?
•S_ISREG(mode) -- Is this a regular file?
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
I used this part in my program char targetName[PATH_MAX + 1];
if( readlink( pathName, targetName, PATH_MAX ) != -1 )
{
printf( "\t%s -> %s\n", pathName, targetName );
}
else
printf( "\t%s -> (invalid symbolic link!)\n", pathName );
and it worked with me.
Thanks so much for your time phoffric !!
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
Also, look at http://www.ibm.com/developerworks/aix/library/au-unix-readdir.html :
•S_ISBLK(mode) -- Is this a block special file? (usually a block-based device of some sort)
•S_ISCHR(mode) -- Is this a character special file? (again, usually a character-based device of some sort)
•S_ISDIR(mode) -- Is this a directory?
•S_ISFIFO(mode) -- Is this a pipe or FIFO special file?
•S_ISLNK(mode) -- Is this a symbolic link?
•S_ISREG(mode) -- Is this a regular file?