I have the following chunk of code in my constructor (This is just an example, the question isn't about split, rather about throwing a generic exception. Also, Boost library can't be used.
Transfer::Transfer(const string &dest){
  try{
    struct stat st;
    char * token;
    std::string path(PATH_SEPARATOR) // if it is \ or / this macro will solve it
    token = strtok((char*)dest.c_str(), PATH_SEPARATOR) // 
    while(token != NULL){
        path += token;
        if(stat(path.c_str(), &st) != 0){
            if(mkdir(path.c_str()) != 0){
                 std:string msg("Error creating the directory\n");
                 throw exception // here is where this question lies
            }
        }
        token = strtok(NULL, PATH_SEPARATOR);
        path += PATH_SEPARATOR;
    }
  }catch(std::exception &e){
       //catch an exception which kills the program
       // the program shall not continue working.
  }
}
What I want is to throw an exception if the directory does not exist and it can't be created. I want to throw a generic exception, how could I do it in C++?
PS: dest has the following format:
dest = /usr/var/temp/current/tree
 
     
     
    