S
sami.jan
Hi
I am using the xlC_r compiler on AIX 5.2 - this program crashes with a
segmentation fault (core dumped) - I compile with a command: xlC_r
filename.C - no switches or anything
------------------------------------------------------------------------------------------------------------------------
#include <iostream.h>
#include <string.h>
char* myfunc()
{
char *temp;
temp = new char(100);
strcpy(temp, "Hello world man");
return temp;
}
int main()
{
cout << myfunc() << endl;
return 0;
}
---------------------------------------------------------------------------------------------------------
#include <iostream.h>
#include <string.h>
char* myfunc()
{
char *temp;
temp = new char(100);
strcpy(temp, "Hello world man");
return temp;
}
int main()
{
cout << myfunc() << endl;
return 0;
}
----------------------------------------------------------------------------------------
but this does'nt:
#include <iostream.h>
#include <string.h>
char* myfunc()
{
char *temp;
temp = new char(100);
cerr << "1" << endl;
strcpy(temp, "Hello world man");
return temp;
}
int main()
{
cout << myfunc() << endl;
return 0;
}
_----------------------_----------------------_----------------------_----------------------_----------------------
The only change is the
cerr << "1" << endl;
line
Any idea why this happens? And also, how do you read a core dump? Any
tools, information regarding this? I opened the core file in a hex
editor and there was too much information to make any sense
Thanks
Sami
I am using the xlC_r compiler on AIX 5.2 - this program crashes with a
segmentation fault (core dumped) - I compile with a command: xlC_r
filename.C - no switches or anything
------------------------------------------------------------------------------------------------------------------------
#include <iostream.h>
#include <string.h>
char* myfunc()
{
char *temp;
temp = new char(100);
strcpy(temp, "Hello world man");
return temp;
}
int main()
{
cout << myfunc() << endl;
return 0;
}
---------------------------------------------------------------------------------------------------------
#include <iostream.h>
#include <string.h>
char* myfunc()
{
char *temp;
temp = new char(100);
strcpy(temp, "Hello world man");
return temp;
}
int main()
{
cout << myfunc() << endl;
return 0;
}
----------------------------------------------------------------------------------------
but this does'nt:
#include <iostream.h>
#include <string.h>
char* myfunc()
{
char *temp;
temp = new char(100);
cerr << "1" << endl;
strcpy(temp, "Hello world man");
return temp;
}
int main()
{
cout << myfunc() << endl;
return 0;
}
_----------------------_----------------------_----------------------_----------------------_----------------------
The only change is the
cerr << "1" << endl;
line
Any idea why this happens? And also, how do you read a core dump? Any
tools, information regarding this? I opened the core file in a hex
editor and there was too much information to make any sense
Thanks
Sami