This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

copying cout and vasprintf


Hi gcc gurus,

I want to output log information from my program to either cout or a file. I want it somewhat like this; 

ostream log_stream;

if (output_stout) {
  log_stream=cout;
} else if (output_file) {
  log_stream=ofstream(log_file);
}

By just trying log_stream=cout; I get this though:
/usr/include/g++/streambuf.h:128: `ios::ios(const ios &)' is private
log.cc:16: within this context

How can I do something like the above?

Another question: I want to use vasprintf(). This does not seem to be ANSI. I tried the following:
#define __USE_GNU
#include <stdio.h>
#include <stdlib.h>

void foo() 
{
  vasprintf(..)
}

g++ tells me that vasprintf is not defined. Do I have to use another preprocessor define that __USE_GNU?


Thanks a lot 


Eddy


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]