void read_string(char * destination, int num_chars_to_read) {
	fgets(destination, num_chars_to_read, stdin);

	// Strip the final new line character
	destination[strcspn(destination, "\n")] = 0;
}

/*
 * This function returns -1 if it fails
 */
char read_char() {
	char return_value;

	char buffer[MAX_BUFFER_SIZE];
	read_string(buffer, MAX_BUFFER_SIZE);
	char garbage[MAX_BUFFER_SIZE]; // this is to collect any garbage AFTER the integer

	if (1 != sscanf(buffer, "%c%s", &return_value, garbage)) {
		// couldn't read an integer
		return_value = ERROR;
	}
	// printf("Garbage: %s", garbage);


	return return_value;
}

/*
 * This function returns -1 if it fails
 */
int read_integer() {
	int return_value;

	char buffer[MAX_BUFFER_SIZE];
	read_string(buffer, MAX_BUFFER_SIZE);
	char garbage[MAX_BUFFER_SIZE]; // this is to collect any garbage AFTER the integer

	if (1 != sscanf(buffer, "%d%s", &return_value, garbage)) {
		// couldn't read an integer
		return_value = ERROR;
	}
	// printf("Garbage: %s", garbage);

	return return_value;
}

