/** * @File : exo_05.cxx * * A.B.Dragut * * @ Date: 2011 * nsFctShell::FileCopy() et nsFctShell::Destroy() * * donneTailleMorceau **/ #include #include #include // struct stat #include //O_RDONLY #include // system() #include "CExc.h" #include "nsSysteme.h" // Stat() using namespace nsSysteme; // Stat() using namespace std; int main (int argc, char * argv []) { try { if (2 != argc) throw CExc ("main()",string ("Usage : ") + argv [0] + " "); string Commande ("ls -l "); Commande += argv[1]; char c; cout << "Avant unlink() : " << flush; system(Commande.c_str()); cout << "Appuyez sur return pour continuer"; cin.get (c); // la commande "system()" montre a l'utilisateur mais pour tester // on essaye d'obtenir des statistiques sur le fichier Source // si il est efface l'erreur sera ENOENT (error no entry) et // dans ce cas on va simplement simplement annonce que le fichier n'existe plus; const int fdSource = Open (argv[1], O_RDONLY); struct stat buf; try { Stat (argv [1], &buf); } catch (const CExc & Exc) { cerr <