Friday, July 4th 2008, 9:22pm UTC+1

You are not logged in.

  • Login
  • Register

Posts: 5

Location: New Zealand

Occupation: high school student and part time grape picker

1

Tuesday, April 15th 2008, 5:25am

Using a pointer to QTextStream segfaults my app

Okay I'm in a tricky spot here.
I have a class for handling a KTextEditer, QTStream and misc other things.
The problem is though that there are two ways to implement file writing
support.

1: Write into the class's private section that there is a stream and then initialize
the stream in the class's constructor. This won't compile with g++.

2: In the class constructor Declare the stream and have in the private section
a pointer (which is then given the address of the real stream in the constructor.
This seamed good in theory but the line: streamPtr->operator<<( editField->text() );
caused a seg fault.

Can somebody explain the correct approach please?
---
Iwasapenguin
  • Go to the top of the page

Rate this thread