Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- *
- * @File :
- *
- * @Author : A. B. Dragut
- *
- * @Synopsis : modelmain
- **/
- #include <string>
- #include <exception>
- #include <iostream>
- #include <unistd.h> // getdtablesize()
- #include <sys/time.h> // fd_set
- #include "nsSysteme.h"
- #include "CExc.h"
- using namespace nsSysteme;
- using namespace std;
- size_t donneTailleMorceau(char * method, char * filename){
- struct stat S;
- Stat(filename,&S);
- std::string m = method;
- if(m == "all"){
- return S.st_size;
- }else if(m == "block"){
- return S.st_blksize;
- }
- return 1;
- }
- int main(int argc, char * argv [])
- {
- try {
- //exo_3.run <methode> <file> <destination>
- std::string method = argv[1];
- std::string file = argv[2];
- std::string destination = argv[3];
- size_t taille = donneTailleMorceau(argv[1], argv[2]);
- nsFctShell::FileCopy(argv[3], argv[2], taille);
- return 0;
- }
- catch (const CExc & Exc) {
- cerr <<Exc<< endl;
- return errno;
- }
- catch (const exception & Exc) {
- cerr << "Exception : " << Exc.what () << endl;
- return 1;
- }
- catch (...) {
- cerr << "Exception inconnue recue dans la fonction main()"
- << endl;
- return 1;
- }
- } // main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement