i ve this small code where temp is string data type.
suppose the value of pos points to a location yet to be filled with data, what would be the value stored in temp?
is it NULL?
temp is not been initialised by any value earlier.
After the end of file,the file is filled with null characters,so if you move the file pointer to a far off place and get a line from there then it inputs several '\0' characters into your string which when output by << doesn't show anything.
NULL is a macro for (void *)0 called null pointer and its completely different from '\0' which is null character with ascii value 0.
After the end of file,the file is filled with null characters
Not necessarily - slack space on a file will generally be filled with whatever happened to have previously been written there on the media - that's why this is a security problem.
The act of reading past end of file will simply fail, and what's stored in your destination variable depends on its type. Numeric types will remain unchanged (hold previous value) while strings depend on the type. C-style will be set as empty strings, string class will maintain previous value.
.....different from '\0' which is null character with ascii value 0.
Which, strictly speaking, has no relevance to the string type, which OP is using.