In my previous question I asked how to read from a memory just as from a file. Because my whole file was in memory I wanted to read it similarly.
I found answer to my question but actually I need to read lines as a wstring
. With file I can do this:
wifstream file;
wstring line2;
file.open("C:\\Users\\Mariusz\\Desktop\\zasoby.txt");
if(file.is_open())
{
while(file.good())
{
getline(file,line2);
wcout << line2 << endl;
}
}
file.close();
Even if the file is in ASCII.
Right now I'm simply changing my string
line to wstring
with a function from this answer. However, I think if there is a way to treat this chunk of memory just like a wistream
it would be a faster solution to get this lines as wstring
s. And I need this to be fast.
So anybody know how to treat this chunk of memory as a wistream
?
wifstream
on ASCII file and load lines inwstring
. I would say it's a conversion 'on the fly'. I mean I could this read ASCII file withifstream
and then convert strings to wstrings but I guess it's faster and easier to simply usewifstream
. – Maladroit