Click here to Skip to main content
15,901,373 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: CListCtrl? Pin
Rajesh R Subramanian12-Jan-06 17:40
professionalRajesh R Subramanian12-Jan-06 17:40 
GeneralRe: CListCtrl? Pin
dipuks14-Jan-06 10:59
dipuks14-Jan-06 10:59 
GeneralRe: CListCtrl? Pin
Rajesh R Subramanian15-Jan-06 16:56
professionalRajesh R Subramanian15-Jan-06 16:56 
GeneralRe: CListCtrl? Pin
dipuks15-Jan-06 18:15
dipuks15-Jan-06 18:15 
QuestionTrying to get an object to bounce back and forth Pin
chadsxe12-Jan-06 13:36
chadsxe12-Jan-06 13:36 
AnswerRe: Trying to get an object to bounce back and forth Pin
Stephen Hewitt12-Jan-06 14:01
Stephen Hewitt12-Jan-06 14:01 
AnswerRe: Trying to get an object to bounce back and forth Pin
Bob Flynn13-Jan-06 0:39
Bob Flynn13-Jan-06 0:39 
Questionofstream driving me nuts Pin
Brian van der Beek12-Jan-06 11:00
Brian van der Beek12-Jan-06 11:00 
Hi,

I have a class that needs to output data to a file. for this I defined a std::ofstream as a class member. However for some reasons I cannot get this to work. Writing to file works fine when I define a std::ofstream locally in a function, but for some reason it does not work when I use the std::ofstream as a class member. This is driving me nuts.

example:
<br />
#include <fstream><br />
<br />
class MyClass<br />
{<br />
public:<br />
  MyClass() {};<br />
  virtuel ~MyClass(){};<br />
<br />
  void WriteSomething();<br />
<br />
private:<br />
  std::ofstream m_file;<br />
<br />
}<br />
<br />
void MyClass::WriteSomething()<br />
{<br />
  CString       str = "test\n";<br />
  std::ofstream file;<br />
<br />
  // does not work.<br />
  m_file.open("c:\\test.txt", std::ios::out);<br />
  m_file.write(str, str.Getlength());<br />
  m_file.close()<br />
<br />
  // does work.<br />
  file.open("c:\\test2.txt", std::ios::out);<br />
  file.write(str, str.Getlength());<br />
  file.close()<br />
}



-- modified at 17:00 Thursday 12th January, 2006
AnswerRe: ofstream driving me nuts Pin
Christian Graus12-Jan-06 12:57
protectorChristian Graus12-Jan-06 12:57 
GeneralRe: ofstream driving me nuts Pin
Brian van der Beek12-Jan-06 20:25
Brian van der Beek12-Jan-06 20:25 
GeneralRe: ofstream driving me nuts Pin
__yb13-Jan-06 12:05
__yb13-Jan-06 12:05 
QuestionC# DLL Pin
siedell12-Jan-06 10:40
siedell12-Jan-06 10:40 
AnswerRe: C# DLL Pin
Christian Graus12-Jan-06 12:56
protectorChristian Graus12-Jan-06 12:56 
QuestionWas It Wininet? Pin
GreenLantern12-Jan-06 9:51
GreenLantern12-Jan-06 9:51 
AnswerRe: Was It Wininet? Pin
Chris Losinger12-Jan-06 10:38
professionalChris Losinger12-Jan-06 10:38 
GeneralRe: Was It Wininet? Pin
GreenLantern12-Jan-06 13:05
GreenLantern12-Jan-06 13:05 
GeneralRe: Was It Wininet? Pin
Chris Losinger12-Jan-06 15:01
professionalChris Losinger12-Jan-06 15:01 
QuestionHow to simulate a line function? Pin
Ming Luo12-Jan-06 8:52
Ming Luo12-Jan-06 8:52 
AnswerRe: How to simulate a line function? Pin
Curtis Schlak.12-Jan-06 10:51
Curtis Schlak.12-Jan-06 10:51 
QuestionCompiling log4cpp or advice for a log api Pin
julian_ross12-Jan-06 8:03
julian_ross12-Jan-06 8:03 
AnswerRe: Compiling log4cpp or advice for a log api Pin
Chris Losinger12-Jan-06 8:39
professionalChris Losinger12-Jan-06 8:39 
GeneralRe: Compiling log4cpp or advice for a log api Pin
julian_ross12-Jan-06 8:50
julian_ross12-Jan-06 8:50 
GeneralRe: Compiling log4cpp or advice for a log api Pin
Bob Flynn12-Jan-06 9:56
Bob Flynn12-Jan-06 9:56 
GeneralRe: Compiling log4cpp or advice for a log api Pin
Julian_CT2K212-Jan-06 22:09
Julian_CT2K212-Jan-06 22:09 
GeneralRe: Compiling log4cpp or advice for a log api Pin
zildjohn0112-Jan-06 10:31
zildjohn0112-Jan-06 10:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.