Parsing the command and paasing the filepath into fopen : The issues is in the pointer I guess. suggest any method to receive a command like "cat serverpath or filepath" and parse the command and to pass the path into fopen(filepath, "r"). to
   here is the code for server:
 

     time_t	start;
            	char	buf[BUFSIZ], *command, content;
            	int	n,i;
            	FILE *fptr;
            
            	start = time(0);
            	(void) pthread_mutex_lock(&stats.st_mutex);
            	stats.st_concount++;
            	(void) pthread_mutex_unlock(&stats.st_mutex);
            	while (1) {
            		bzero(buf, BUFSIZ);
            		n = recv(fd, buf, BUFSIZ, 0);
            		if (n < 0){
            			errexit("echo read: %s\n", strerror(errno));
            }
            else{
        printf("The client message: %s\n",buf);
        }
        
        
        
        
        strtok_r (buf, " ", &command);
        printf("%s\n", buf);
        printf("%s\n",command);
          
          
            //char filename[100], c; 
          
           // printf("Enter the filename to open \n"); 
           // scanf("%s", command); 
          
            // Open file 
            fptr = fopen(command, "r"); 
            if (fptr == NULL) 
            { 
                printf("Cannot open file \n"); 
                exit(0); 
            } 
          
            // Read contents from file 
            content = fgetc(fptr); 
            while (content != EOF) 
            { 
                printf ("%c", content); 
                content = fgetc(fptr); 
            } 
          

 error in fopen.

   
