saveBytes()
Output / FilesDescription
Writes a vector of bytes to a file.
Syntax
bool saveBytes(std::string path, std::vector<unsigned char> data)
Parameters
| Name | Type | Description |
|---|---|---|
| path | std::string | path to write to |
| data | std::vector | bytes to write |
Returns
boolRelated
Under the Hood
From Processing.h:
inline bool saveBytes(const std::string& path, const std::vector<unsigned char>& data) {
std::ofstream f(path,std::ios::binary); if (!f) return false;
f.write(reinterpret_cast<const char*>(data.data()),data.size());
return true;
}
inline bool saveStream(const std::string& path, const std::vector<unsigned char>& data) { return saveBytes(path,data);
static bool saveBytes(const std::string& path, const std::vector<unsigned char>& d);
Under the Hood
From Processing.cpp:
bool PApplet::saveBytes(const std::string& path, const std::vector<unsigned char>& data) {
std::ofstream f(path, std::ios::binary); if (!f) return false;
f.write(reinterpret_cast<const char*>(data.data()), data.size()); return true;
}