"no newline at end of file" C : <p>I'm using this command to compile:</p>

<p><code>gcc –Werror –std=c99 client.c –o client</code> </p>

<p>CODE:</p>

<pre><code>#include &lt;string.h&gt;
#include &lt;stdio.h&gt;
#include &lt;strings.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;unistd.h&gt;
#include &lt;netdb.h&gt;
#include &lt;sys/types.h&gt;
#include &lt;sys/socket.h&gt;
#include &lt;netinet/in.h&gt;


#define BUFFER_SIZE 1000
#define PORT_NUM 8888

void error(char *msg)
{
    perror(msg);
    exit(0);
}

int main(int argc, char *argv[])
{
    int sockfd, portno, n;

    struct sockaddr_in serv_addr;
    struct hostent *server;
    char buffer[BUFFER_SIZE];

    if (argc &lt; 3) {
       fprintf(stderr,"usage %s hostname port\n", argv[0]);
       exit(0);
    }
    portno = atoi(argv[2]);

    sockfd = socket(AF_INET, SOCK_STREAM, 0);
    if (sockfd &lt; 0) 
        error("ERROR opening socket");

    server = gethostbyname(argv[1]);
    if (server == NULL) {
        fprintf(stderr,"ERROR, no such host\n");
        exit(0);
    }

    bzero((char *) &amp;serv_addr, sizeof(serv_addr));
    serv_addr.sin_family = AF_INET;
    bcopy((char *)server-&gt;h_addr, 
         (char *)&amp;serv_addr.sin_addr.s_addr,
         server-&gt;h_length);
    serv_addr.sin_port = htons(portno);
    if (connect(sockfd,(struct sockaddr *)&amp;serv_addr,sizeof(serv_addr)) &lt; 0) 
        error("ERROR connecting");

   while (1) 
   {
        bzero(buffer, BUFFER_SIZE);
        fgets(buffer, BUFFER_SIZE, stdin);
        if((strncmp(buffer,"close",5) == 0 ))
            break;
        printf("Please enter the message: ");
        bzero(buffer, BUFFER_SIZE);
        n = write(sockfd,buffer,strlen(buffer));
        if (n &lt; 0) 
            error("ERROR writing to socket");
        bzero(buffer, BUFFER_SIZE);
        n = read(sockfd,buffer, BUFFER_SIZE-1);
        if (n &lt; 0) 
            error("ERROR reading from socket");
        printf("%s\n",buffer);
    }

    close(sockfd);

    return 0;

}
</code></pre>

<p>Trying to compile it in a shell on VM whos OS is linux
This error is driving me crazy, I don't understand what to do inorder to fix this.
I thought the client.c file is damaged, so I copied and pasted into a new .c file. When that failed, I wrote it from 0 and still getting this error.</p>

<p>Thanks in advance!</p>
