I did a test with buffer.getline(*char, count, termchar) utilizing an ifstream buffer.
I always assumed that a null pointer was written after the last character of the established array only.
I was doing a test to check for this character and found it in every array position past my data.
cin.getline(array, 24, '\n'); // only I was using a different char buffer
I found that if I typed (or read in) 1234 that array=='4' and array=='\0' ... and that was to be expected.
But then I found array through array where also equal to '\0'. (I only picked a couple to look at, so there may be an error in my findings)
This is something that I didn't know. Do the test for yourself if you do not know the reasons for this already. Why do you think that it would be such? What is the point of overwriting the entire array with null values after the data? What is your opinion on this? Am I wrong?
It depends where your buffer is allocated and how it is initialised. If it's unintialised on the stack or has previous data in it then they'll it shouldn't be full of null characters.