byte array
int length = 2000; byte* buf = new byte[length]; std::ifstream ifs(path, std::ios_base::in | std::ios::binary); if (ifs) { ifs.read((char*)buf, length); ifs.close(); }
shared_ptr
int length = 2000; std::shared_ptr
buf(new byte[length]); //std::shared_ptr
buf = std::shared_ptr
(new byte[length]); std::ifstream ifs(path, std::ios_base::in | std::ios::binary); if (ifs) { ifs.read((char*)buf.get(), length); ifs.close(); }
STL
byte
shared_ptr
Retrieved from http://hyacinth.byus.net/moniwiki/wiki.php/C++/STL/byte array to shared_ptr
last modified 2015-05-19 12:42:39