Everything goes right. But when I remove thread.join ( because I don't need to wait ), then I got strange symbols when I output 'local' and 'remote' params in function '_getfile'. Whats wrong with it?
If it does, the problem is that the lifetime of the pointer returned by std::string::c_str() is bound to the lifetime of the std::string object. Since you don't join, the std::strings are free to go out of scope while _getfile() is still running.
The easiest solution is to just pass copies of the strings and let the callee take ownership of them.