I\'m writing a program to check to see if a port is open in C. One line in particular copies one of the arguments to a char array. However, when I try to compile, it says:
The line
addr = strncpy(addr, argv[2], 1023);
should be just
strncpy(addr, argv[2], 1023);
note that strncpy doesn't null-terminate if the 1023 limit is reached so you should also have
addr[1023] = `\0`;
though I suppose there's other assumptions made in the code as well.