What happens if a file contains a \\0
character when using istream::getline()
? Will be it be omitted or still assigned into a field in the string buffer?
Assuming you meant istream::getline() I don't see why a null char would ignored. Reading the description on http://en.cppreference.com/w/cpp/io/basic_istream/getline I see nothing that treats \\0 in any special way unless you use it as the delimiter.
Short story: it get placed in the extracted string.
A null character ('\\0') is automatically appended to the written sequence if n is greater than zero, even if an empty string is extracted.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.