0

I have a .txt file saved in memory ( void *Buffer; UINT itsLen ). Is there any easy way to read this text file like std::wifstream read txt from a disk?

1
  • Is itsLen the size of the buffer in bytes? Commented Feb 2, 2014 at 22:28

1 Answer 1

2

Yes; use a string stream.

#include <string> #include <sstream> 

...

wchar_t* p = static_cast<wchar_t*>(Buffer); std::wistringstream s(std::wstring(p, p + itsLen/sizeof(wchar_t))); 

The string stream s can be used similarly to a std::wifstream object.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.