Replace Filename Extension (C++17)

Note this only works in C++ 17 (or boost::filesystem on lower):

#include <filesystem>

namespace fs = std::filesystem;

fs::path p(full_path);
p.replace_extension();

.replace_extension() by default removes an extension, but you can pass what to replace it with, for instance .replace_extension(L".png").


To contact me, send an email anytime or leave a comment below.