最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c++ - Renaming a file without changing its extension - Stack Overflow

programmeradmin2浏览0评论

I have a file name as a std::string that is comprised of a file and path, and I want to rename the file, but keep the extension the same.

As an example change abc to ijk:

/dir1/dir2/dir3/abc.txt  ---> /dir1/dir2/dir3/ijk.txt

../../dir1/abc.txt  ---> ../../dir1/ijk.txt

I know this can be done using some kind of string processing, but I'd like to use the std::filesystem path as it handles all the edge cases.

Is there a way to do this with the std::filesystem path facilities?

发布评论

评论列表(0)

  1. 暂无评论