c-project/C Project/C Project/chatbot.c
int chatbot_do_load(int inc, char* inv[], char* response, int n) {
	int line = 0;

	if (inv[1] == NULL) {
		strcpy(response, "ERROR! No file was selected");                    // Error check if the user did not select a file
	}
	else {
		FILE* file;

		if (file = fopen(inv[1], "r")) {                                    // Open the file in read only mode
			line = knowledge_read(file);                                    // Call the knowledge_read function in knowledge.c to get the number of entries from the file
			fclose(file);                                                   // Remember to close the file
			snprintf(response, n, "Read %d responses from %s", line, inv[1]);    // Output to user to say that the file was read
		}
		else {
			strcpy(response, "No such file exist!");                        // Error check if the file is not found
		}
	}
	return 0;
}
/*
 * Load a chatbot's knowledge base from a file.
 *
 * See the comment at the top of the file for a description of how this
 * function is used.
 *
 * Returns:
 *   0 (the chatbot always continues chatting after loading knowledge)
 */
Load a chatbot's knowledge base from a file.

See the comment at the top of the file for a description of how this
function is used.

0 (the chatbot always continues chatting after loading knowledge)
Load a chatbot ' s knowledge base from a file . See the comment at the top of the file for a description of how this function is used . 0 ( the chatbot always continues chatting after loading knowledge )
int chatbot_do_load(int inc, char* inv[], char* response, int n) {
	int line = 0;
	if (inv[1] == NULL) {
		strcpy(response, "ERROR! No file was selected");                    
	}
	else {
		FILE* file;
		if (file = fopen(inv[1], "r")) {                                    
			line = knowledge_read(file);                                    
			fclose(file);                                                   
			snprintf(response, n, "Read %d responses from %s", line, inv[1]);    
		}
		else {
			strcpy(response, "No such file exist!");                        
		}
	}
	return 0;
}
int chatbot_do_load ( int inc , char * inv [ ] , char * response , int n ) { int line = 0 ; if ( inv [ 1 ] == NULL ) { strcpy ( response , " " ) ; } else { FILE * file ; if ( file = fopen ( inv [ 1 ] , " " ) ) { line = knowledge_read ( file ) ; fclose ( file ) ; snprintf ( response , n , " " , line , inv [ 1 ] ) ; } else { strcpy ( response , " " ) ; } } return 0 ; }
Load a chatbot's knowledge base from a file.
Load a chatbot ' s knowledge base from a file .
// Error check if the user did not select a file
 // Open the file in read only mode
 // Call the knowledge_read function in knowledge.c to get the number of entries from the file
 // Remember to close the file
 // Output to user to say that the file was read
 // Error check if the file is not found
