binary - C++ memset - Extract size bytes and copy them to the supplied data address from buffer -
is there way set start position char pointer, file in memory.
i need read extract size bytes of data stream, , copy them supplied data address , return number of bytes read. memset tryout, try someting fread file in memory. hope can me.
typedef signed long long int64; // osx example int64 filestream::read(void* data, int64 size) { // make sure, size not > filename int64 wanted_buffer = currentposition + size; if (wanted_buffer > memfile->getsize()) size = memfile->getsize() - currentposition; // tryout memcpy memcpy(data, currentposition + memfile->getbuffer(), size); currentposition += size; // // return std::fread(data, 1, static_cast<std::size_t>(size), m_file); return currentposition; }
if you're able use c file
struct can use fseek
on file *
.
Comments
Post a Comment