0

I loaded an entire audio file into memory. Now I need to read from different offsets, in different amounts, with various callbacks.

Is it possible to use the data in memory as in std::istream?

memFile.read, memfile.seekg, memFile.telgq...

Let's say I have something like:

size_t dataSize = fileLenght; // for example 5672 
char *fullData = new char[dataSize];
// copy data to fullData...

Then I want to do something like:

std::istream / fstream / ifstream dataObj(fullData);

dataObj.seekq(0, begin);
dataObj.read(....);

These are pseudo code. Things can be different.

I have the start position, end position and length of the file loaded into memory.

  • https://en.cppreference.com/w/cpp/io/basic_stringstream https://www.boost.org/doc/libs/1_76_0/libs/iostreams/doc/index.html – Alan Birtles Aug 01 '21 at 08:04

1 Answers1

0

With a basic search the following answer solved my problem. I've done research with complex sentences before. Sorry for the inconvenience.
I am new to C++ and there are many methods, many different approaches in this language.

How can I read from memory just like from a file using iostream?