C
C@limero
If I want to declare a function in a header file that returns a
string, I always get an error (something complaining about
a syntax error before an ')').
I have declared:
#ifndef MYHEADER_H
#define MYHEADER_H
string function(int day, int month, int year);
#endif
But then I get always an error from the compiler.
If I change this to
#ifndef MYHEADER_H
#define MYHEADER_H
const char* function(int day, int month, int year);
#endif
I get no error.
But the problem then is, since I use an std:stringstream oss in
the definition, I have to write "ugly" things like
return oss.str().c_str();
Is there a way to bypass this ?
string, I always get an error (something complaining about
a syntax error before an ')').
I have declared:
#ifndef MYHEADER_H
#define MYHEADER_H
string function(int day, int month, int year);
#endif
But then I get always an error from the compiler.
If I change this to
#ifndef MYHEADER_H
#define MYHEADER_H
const char* function(int day, int month, int year);
#endif
I get no error.
But the problem then is, since I use an std:stringstream oss in
the definition, I have to write "ugly" things like
return oss.str().c_str();
Is there a way to bypass this ?