char ** split(const string & str, int arguments){ char ** argv; argv = new char * [arguments]; uint index = 0; int offset = 0; int argcount = 0; do{ index = 0; while (str[index + offset] != ' ' && index + offset < str.length()){ index ++; } argv[argcount] = strcpy(new char [str.length()+1], str.substr(offset,index).c_str()); offset += index + 1; argcount += 1; } while (index + offset < str.length()); return argv; }