Because write()
won't change the contents of the buffer, but only write it to the file.
On the other hand, read()
will change its buffer (from what's in the file) so it had better not be const
.
General rule, what changes isn't const
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…