Ok So I want to be be able to grab the IP in human readable form from a device. (I know there are many ways of doing this)
I've come across something odd though...
after this section of code my program terminates prematurely...
As in it carries out the final printf before quitting .... the next line after that is
printf("gotpastsetup");
and that is not run....(after that there is a whole bunch of other stuff)
I'm extremely confused why is it exiting?
I guess it's because you are not allocating any memory for char *buf
And since no memory has been allocated it gives segmentation fault when you try to print it.
That's usually due to bugs inside your code that are dependent on memory layout. This is very typical when an invalid or uninitialized pointer is dereferenced.