#include <stdio.h> #include <iostream> #include <string> #include <windows.h> #include <fstream> using namespace std; void writeFile(string path,string content) { ofstream ofs; ofs.open((char*)path.c_str(), ios::out); ofs << content << endl; ofs.close(); } void main(int count, int* args[]) { if (count != 2)return; char* ch = (char*)args[1]; string str = ch; string res = ""; for (size_t i = 0, len = str.length(); i < len; i++) { if ((const char)str[i] == '\\') { res.push_back('/'); } else { res.push_back(str[i]); } } if (OpenClipboard(NULL)) { HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, str.size() + 1); memcpy(GlobalLock(hMem), str.c_str(), str.size() + 1); GlobalUnlock(hMem); EmptyClipboard(); SetClipboardData(CF_TEXT, hMem); CloseClipboard(); GlobalFree(hMem); } //writeFile("D:\\Desktop\\test\\c++\\copyPath\\x64\\Debug\\xlog.txt",res); return; }