C++中如何使用内存文件
#include <iostream> #include <strstream> using namespace std; int main() { char szBuf[16] = {"hello world!"}; std::strstreambuf memo(szBuf,sizeof(szBuf)); std::istream ss(&memo); ss.seekg(0); char data[4] = {0}; ss.read(data,sizeof(data)); return 0; }