B
Baget
Hello
this code does not compile on VC6, it compile fine on other compilers on
two OS (gcc, bcc, VC7 on windows, gcc on Linux).
I am getting error C2057 on VC6
what to do?
========== START CODE ============
#include <iostream>
#include <cstring>
using namespace std;
class Foo {
public:
Foo(const char *a);
const char *getArray() const;
private:
static const unsigned int MY_SIZE = 20;
char myarray_[MY_SIZE];
};
Foo::Foo(const char *a)
{
strncpy(myarray_, a, MY_SIZE);
}
const char* Foo::getArray() const
{
return myarray_;
}
int main()
{
Foo bar("Test");
cout<<bar.getArray()<<endl;
return 0;
}
========== END CODE ==============
this code does not compile on VC6, it compile fine on other compilers on
two OS (gcc, bcc, VC7 on windows, gcc on Linux).
I am getting error C2057 on VC6
what to do?
========== START CODE ============
#include <iostream>
#include <cstring>
using namespace std;
class Foo {
public:
Foo(const char *a);
const char *getArray() const;
private:
static const unsigned int MY_SIZE = 20;
char myarray_[MY_SIZE];
};
Foo::Foo(const char *a)
{
strncpy(myarray_, a, MY_SIZE);
}
const char* Foo::getArray() const
{
return myarray_;
}
int main()
{
Foo bar("Test");
cout<<bar.getArray()<<endl;
return 0;
}
========== END CODE ==============