loadBytes()
Input / FilesDescription
Reads the contents of a file into a vector of bytes.
Syntax
std::vector<unsigned char> loadBytes(std::string path)
Parameters
| Name | Type | Description |
|---|---|---|
| path | std::string | path to the file |
Returns
std::vectorRelated
Under the Hood
From Processing.h:
inline std::vector<unsigned char> loadBytes(const std::string& path) {
std::ifstream f(path,std::ios::binary);
return std::vector<unsigned char>((std::istreambuf_iterator<char>(f)),std::istreambuf_iterator<char>());
}
static std::vector<unsigned char> loadBytes(const std::string& path);
Under the Hood
From Processing.cpp:
std::vector<unsigned char> PApplet::loadBytes(const std::string& path) {
std::ifstream f(path, std::ios::binary);
return std::vector<unsigned char>((std::istreambuf_iterator<char>(f)), std::istreambuf_iterator<char>());
}