FQDN and getdomainname

I have a need to create a connection between an erlang node and my C program.
the name of an erlang node looks something like monitor@host1.ipc.co.za.
The piece of code I have to construct a node name looks like this:

char *hostname, *domainname, *nodename = "monitor", *thisfullnodename;

//Aaahhhhh. Me *little* handler for dose nasty segments
signal( SIGSEGV, (void *)cleanup );

gethostname( hostname, 31 );
getdomainname( domainname, 31 );
strncat( thisfullnodename, nodename, strlen(nodename) );
strncat( thisfullnodename, "@", 1 );
strncat( thisfullnodename, hostname, strlen(hostname) );
strncat( thisfullnodename, domainname, strlen(domainname) );

puts( thisfullnodename );

The puts statement at the end should print monitor@host1.ipc.co.za, but it doesn't it only prints monitor@host1.

Any thoughts ? Ideas ? Help ?

Don't worry. Problem solved