随笔- 191  文章- 0  评论- 3  阅读- 59067 
复制代码
#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, res.size() + 1);
        memcpy(GlobalLock(hMem), res.c_str(), res.size() + 1);
        GlobalUnlock(hMem);
        EmptyClipboard();
        SetClipboardData(CF_TEXT, hMem);
        CloseClipboard();
        GlobalFree(hMem);
    }

    // writeFile("D:\\Desktop\\test\\c++\\copyPath\\x64\\Debug\\xlog.txt",res);

    return;
}
复制代码

 

 posted on   laremehpe  阅读(23)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
点击右上角即可分享
微信分享提示