I\'m trying to write the contents of buf pointer to the file created by ofstream.
For some reason the file is empty, however the contents of buf is never empty... What
Is your stream opened before writing on it ? Could be anything from not-enough disk space to unsufficient permissions.
Also you may have an error:
ofstr << *buf;
Should be something like:
ofstr << buf;
Since buf is a char*, *buf gives a char, not a char*.
This is where using std::string instead of raw buffers/pointers makes sense ;)