Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are standard text files NULL-terminated?

I am writing a C++ program that reads a file and then sends it to another class as a character array. Because character arrays only get passed by pointer, all size is lost.

The file it'll be reading will be a text file. Are text files null terminated?

Preferably I do not want to use a Vector as I really don't need any of it's features but the size of the array.

like image 418
Jeroen Avatar asked Jul 10 '13 13:07

Jeroen


1 Answers

No.
Files have a known length, so they do not need any terminator byte.

like image 166
SLaks Avatar answered Sep 27 '22 20:09

SLaks