Two problems with your code.
First, it looks like you're not accounting for newlines in your maxNum buffer size, so it stops reading either 19 or 38 characters before the end of the text file (depending on if you're using Unix-style or Windows-style line breaks). Either increase the value of maxNum accordingly, or remove the line breaks from your text file.
Second, since you're using a char array instead of a std::string to hold the buffer, it needs to be null-terminated to display properly if you use the stream operator. Add the following line after you read the buffer in (you'll also need to increase your buffer size by one to account for the extra character).
buffer[maxNum-1] = '\0';
Alternatively, you can use cout.write() to display a known-length buffer that's not null-terminated, as follows:
cout.write(buffer, maxNum);