Image

Imagesparkymark wrote in Imagecpp

ostream problem

Why does test.log contain a hex number (presumably the address of the string I am trying to print)? The ultimate aim is to write a class derived from ofstream that can also be writing to a private buffer as it outputs but ths is the simplest example that reproduces my problem with it.
I can only think some lowest-common-denominator (pointer to void?) overload of << is being called, but why?

#include 
#include 
[Error: Irreparable invalid markup ('<stdlib.h>') in entry. Owner must fix manually. Raw contents below.]

Why does test.log contain a hex number (presumably the address of the string I am trying to print)? The ultimate aim is to write a class derived from ofstream that can also be writing to a private buffer as it outputs but ths is the simplest example that reproduces my problem with it.
I can only think some lowest-common-denominator (pointer to void?) overload of &lt;&lt; is being called, but why?

<pre>
#include <iostream>
#include <stdlib.h>
#include <iostream>
#include <fstream>
using namespace std;

class Sneaker : public ofstream {
public:
Sneaker(const char * file) : ofstream(file) {};
ostream &operator<<( const char *);

};
ostream &Sneaker::operator<<(const char * data) {
ofstream::operator<<(data);
return *this;
}
int main()
{
Sneaker out("test.log");
out << "hello world";
return 0;
}
</pre>