Hi I am new in C programming language...
I am writing a simple FTP Server-Client program,
and I want to print out the client IP address for each successful login.

Here's the code that I encountered warning:
struct sockaddr_in ser_addr;

printf("IP: (%s); Port: (%d)\n",
inet_ntoa(ser_addr.sin_addr), ntohs(ser_addr.sin_port));

When I compile the program, it keep showing this annoying message:
warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int’ [-Wformat]

May I know what's the problem here?
Is it because I am putting a wrong datatype? or wrong cast of the datatype?

Thanks... =)

Strange... should work...
Can you post the whole file? Which compiler? (you're sure that the inet_ntoa function is known?)

Pieter
Bytelead

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.