gulrak / filesystem

An implementation of C++17 std::filesystem for C++11 /C++14/C++17/C++20 on Windows, macOS, Linux and FreeBSD.
MIT License
1.34k stars 173 forks source link

How to write to file? #85

Closed paulocoutinhox closed 3 years ago

paulocoutinhox commented 3 years ago

Hi,

How to write to file?

On Poco i do for normal content:

Poco::FileOutputStream stream(path, std::ios::out | std::ios::binary | std::ios::trunc);
stream << content;
stream.close();

And on binary file:

Poco::FileOutputStream stream(path, std::ios::in | std::ios::binary);

for (auto &data : content)
{
    stream << data;
}

stream.close();

Thanks for this great library!

paulocoutinhox commented 3 years ago

Hi,

I see that filesystem don't manipulate files, but only paths.

Answer here how to mix it:

https://stackoverflow.com/questions/36775493/create-file-with-filesystem-c-library

Thanks.