Is it the function itself that core dumps or the "cout << ... astrstr()" part?
Possible cout << NULL won't go down very well; you can solve this by checking the return value before using it.