c++ 产生不重复独有文件名
#include <iostream>
#include <cstdio>
#include <string>
int main()
{
    int pos;
    std::string fileName;
    std::string final;
    for(int i = 0; i < 10; i++)
    {
        std::string name = std::tmpnam(nullptr);
        pos = name.find_last_of('/');
            fileName = name.substr(pos + 1);
        final = fileName + ".jpg";
        std::cout << final << std::endl;
    }
}
    
    
    如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!
支付宝打赏
     
微信打赏
     
txttool.com 说一段 esp56物联 查询128 IP查询