![]() |
| | #1 |
| Guest
Posts: n/a
| As the subject states, I am re-writing the ls -F command in C++, but I am having trouble adding some of the Formatting characters to the files names. Here is my code: Code: if (strcmp(buff, "-F")==0)
{
struct stat s;
stat(direntp->d_name,&s);
cout<<direntp->d_name;
if(s.st_mode & S_IFDIR)
cout<<"/"<<endl;
else
if(s.st_mode & S_IFIFO)
cout<<"|"<<endl;
else
if(s.st_mode & S_IFLNK)
cout<<" "<<endl;
else
if(s.st_mode & S_IFDOOR)
cout<<">"<<endl;
else
if(s.st_mode & S_IFSOCK)
cout<<"="<<endl;
else
if((s.st_mode & S_IXUSR) && (s.st_mode & S_IFLNK))
cout<<"*"<<endl;
else
cout<<"?"<<endl;
}//end if
Code: mars:$ a.out -F ./ ../ shell1.cpp env.c core a.out modshell2.1.cpp read_command shell.sh shell test.sh ansipr shell2.c.save paige_sh modshell1.2.cpp modshell1.3.cpp gid.c modshell2.3.cpp 1814shell.cpp cpplist uid.c listfile.txt listDir.cpp modshell2.cpp modshell2.2.cpp rewritels.cpp writels2.cpp justafile.txt justafile2.txt justadir/ justadir2/ |
|
| | #2 |
| Guest
Posts: n/a
| never mind...fixed it myself |
|
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| writing and appending to file lots of times takes to long how to improve ? | umen242 | C++ Programming | 2 | 05-20-2008 08:57 AM |
| version of ls -l bug, only takes cwd :( | chl12 | C Programming | 2 | 06-12-2007 02:44 AM |
| Very slow file writing of 'fwrite' function in C | scho | C Programming | 6 | 08-03-2006 02:16 PM |
| Folding@Home Cboard team? | jverkoey | General Discussions | 398 | 10-11-2005 08:44 AM |
| help! fifo read problem | judoman | C Programming | 1 | 08-16-2004 09:19 AM |