file.open("1.txt");
file.seekp(pos,ios::beg);
getline(file,temp);
file.close();

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.

I would expect temp to still be be an empty string.

Note that an empty string is one which has no content. It is not the same as NULL.

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.

Content of temp (it is empty) will not modified.

// assume that a string temp contains "Hello"
file.open("1.txt");
file.seekp(pos,ios::beg);
getline(file,temp);
file.close();

After the code execution temp remains unchanged. i.e it is "Hello"

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.

This question has already been answered. Start a new discussion instead.