Qt-interest Archive, August 2007
QTextStream issue
Message 1 in thread
Hi
I have a single-threaded, single-widget application. Just want to log
some stuff. The code below gives an error below that.
header
class myview : public Q3VBox
{
Q_OBJECT
public:
private:
QFile* log_file;
QTextStream* logger
[snip]
}
source
myview::get_settings()
{
char* l_file = getenv("MYVIEW_LOG");
QFile log_file( l_file );
logger = new QTextStream( &log_file );
logger << "text" << endl;
}
myview.cpp:206: error: invalid operands of types ‘QTextStream*’ and
‘const char [6]’ to binary ‘operator<<’
--
[ signature omitted ]
Message 2 in thread
> QFile* log_file;
> QTextStream* logger
> [snip]
> }
>
> source
>
> myview::get_settings()
> {
> char* l_file = getenv("MYVIEW_LOG");
> QFile log_file( l_file );
> logger = new QTextStream( &log_file );
>
> logger << "text" << endl;
> }
>
> myview.cpp:206: error: invalid operands of types 'QTextStream*' and
> 'const char [6]' to binary 'operator<<'
>
Try
*logger << "text" << endl
Deference the pointer
Scott
--
[ signature omitted ]