00001
00002
00003
00004
00005
00006
00007 #include <iostream>
00008 #include <unistd.h>
00009 #include <stdlib.h>
00010 #include <string.h>
00011
00012 #include "ComPlusPlus/ComPlusPlus"
00013
00014 int main( int argc, char * argv [] ) {
00015
00016 if ( argc != 2 ) {
00017 std::cout << "usage: ExampleDirEnt Filename\n";
00018 exit (1);
00019 }
00020
00021 try {
00022 if ( ! compp::DirEntry::Exist ( argv [1] ) ) {
00023 std::cout << argv [1] << " does not exist.\n";
00024 exit ( 1 );
00025 }
00026
00027 compp::DirEntry Entry ( argv [ 1 ] );
00028
00029 std::cout << "Entry.getName " << Entry.getName () << "\n";
00030 std::cout << "Entry.isDirectory " << Entry.isDirectory () << "\n";
00031 std::cout << "Entry.isRegularFile " << Entry.isRegularFile () << "\n";
00032 std::cout << "Entry.isCharDevice " << Entry.isCharDevice () << "\n";
00033 std::cout << "Entry.isBlockDevice " << Entry.isBlockDevice () << "\n";
00034 std::cout << "Entry.isFIFO " << Entry.isFIFO () << "\n";
00035 std::cout << "Entry.isSocket " << Entry.isSocket () << "\n";
00036 std::cout << "Entry.isSymLink " << Entry.isSymLink () << "\n";
00037 std::cout << "Entry.getInode " << Entry.getInode () << "\n";
00038 std::cout << "Entry.getAccessTime " << Entry.getAccessTime() << "\n";
00039 std::cout << "Entry.getChangeTime " << Entry.getChangeTime() << "\n";
00040 std::cout << "Entry.getLastModificationTime " << Entry.getLastModificationTime() << "\n";
00041 std::cout << "Entry.getSize " << Entry.getSize() << "\n";
00042 std::cout << "Entry.getUid " << Entry.getUid() << "\n";
00043 std::cout << "Entry.getGid " << Entry.getGid() << "\n";
00044 std::cout << "Entry.getNumLinks " << Entry.getNumLinks() << "\n";
00045
00046 } catch ( syspp::ComException & e ) {
00047 std::cout << "Exception " << e.what() << "\n";
00048 }
00049
00050 return 0;
00051 }