segmentation fault inet_ntop()
Hi all,
I am getting segmentation fault in inet_ntop(AF_INET6, &src, source, 40); variables are declared as: char *source; struct in6_addr src; Using g++ compiler to compile c++ source. Any help? |
Segfault
A piece of code is trying to use the same chunk of memory as another piece if code. You need to debug it. Configure GCC with --enable-checking . Compile it with -g -O0 so that you can use gdb. There are lots of pieces of advice on this particular subject as almost no-one who learns C or C++ doesn't get segfaults. You should track it down and if you compile it so gdb can do it's work you will have a 'Eureka' moment. But just a moment. The snippet of code, although well intentioned is not helpful. Good luck because you will overcome this hurdle.
If I helped at all give me a pat on the back (add to my reputation) |
I have already tried gdb and got the exact location of seg fault using this only. gdb traceback shows seg fault in the line inet_ntop(AF_INET6, &src, source, 40);
Strangely, the same code works fine with gcc but not with g++. I need to get it working in c++. |
Segfault in internet address function
Here is a page with examples and explanation, perhaps you see what is wrong with your code. More code would have been better.
the objective is turn the machine readable address into human readable. |
All times are GMT -5. The time now is 01:43 PM. |