0

Hi all,

I have a disk file define as

TCHAR szTempFile[MAX_PATH];

What I want to do is, read that file into memory stream. To a buffer. How can I do it.

2
Contributors
5
Replies
6
Views
9 Years
Discussion Span
Last Post by eranga262154
0

No you can't, you'll have to convert it first. If your program ISN'T compiled with unicode: ifstream myfile ((char*)szTempFile); If you ARE using unicode:

#include <cstdlib>
[.......]
const int BUFSIZE = 100;
char buffer[BUFSIZE];
wcstombs(buffer, szTempFile, BUFSIZE );
ifstream myfile (buffer);
0

I got all those things to done because of the following example.

XML Writer in C++

Can you just see it.

What I have done is, output stream write to a disk file and then read the file to memory. It's odd.

So i try to directly write that stream to memory. But wired with it, I can't use char buffer for that.

Can you help me to do it. Any clue..

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.