You should actually use the length returned by toWCharArray() instead of save_path.length(), sorry.