How to send a file from server to client.
I am a bigger in C with unix, i am trying to read a file from server and display it in client , i got a separate code to read a file , and i tried to connect the server and client with the following code is working fine only it shows a warning.
I am using the sample code from the follosing site
the connection is working fine , but i dont know how to add the sending and receving code in to it and the text reading code in to that code...
if any one can help me , It would be much appreciated. Thank You for reading.
file reading code i am using is as fallows.
int main ( void )
static const char filename = "file.txt";
FILE *file = fopen ( filename, "r" );
if ( file != NULL )
char line [ 128 ]; /* or other suitable maximum line size */
while ( fgets ( line, sizeof line, file ) != NULL ) /* read a line */
fputs ( line, stdout ); /* write the line */
fclose ( file );
perror ( filename ); /* why didn't the file open? */