Mail Archives: djgpp/1998/11/24/16:15:14
Michael Schuster wrote:
>
> Hi everyone!
>
> I'm desperately searching for a bug in my new 2.8.1 djgpp
> installation, but cannot find it.
>
> The problem I face is the damn old String class problem which I posted
> already 2 times.
> As I want to know, if I do something wrong, I ask you if someone with
> a 2.8.1 can compile the following little c++ code (which I cnly can
> compile with my 2.7.xx djgpp?
>
> #include <iostream.h>
> #include <string.h>
> #include <_String.h>
>
> String xc="test2";
> char d[25]="dummy";
>
> int main()
> {
> xc=d;
> strcpy(d,xc);
> cout<<d;
> }
Note that the following will work and may be what you want:
#include <iostream>
#include <string>
string xc = "test2";
char d[25] = "dummy";
int main()
{
xc = d;
strcpy(d, xc.c_str());
cout << d << endl;
}
Martin Ambuhl (mambuhl AT earthlink DOT net)
Note: mambuhl AT tiac DOT net will soon be inactive
- Raw text -