Return NULL if EOF is encountered before terminating_string.