#create filesystem path
1 messages · Page 1 of 1 (latest)
In C++, creating a filesystem path is easiest with the standard library’s C++17 std::filesystem (available since C++17).
Example:
#include <iostream>
#include <filesystem>
namespace fs = std::filesystem;
int main() {
// Create a path object
fs::path myPath = "folder/subfolder/file.txt";
std::cout << "Path: " << myPath << std::endl;
// Create directories if they don't exist
fs::create_directories("folder/subfolder");
return 0;
}
If you're using an older compiler (pre-C++17), you’d need Boost.Filesystem instead.
Yo wtf
Msvc?
yep using clang
thats what i did tho (as shown in the screenshot lol)
oh wait no, im pretty sure im using clang
Hmmm
Try doing
fs::path var = std::string("ur steing")
Maybe ts work
What then it should work
should i try compiling anyway
Tru
to see if it'll error
Try
lmao it actually didnt error
im assuming it wouldve failed on compiling with a syntax error or type error
What the
Now u gotta fic the visual studio erorr
yea
not sure why it's doing that
just tried to restart the language server, but it still shows