我们知道,当插入\n
文件流时,系统的适当行尾序列将被写入文件(例如\r\n
对于 Windows)。插入结束行是否会std::stringstream
导致将适合系统的行尾序列写入字符串?例如:
#include <sstream>
int main()
{
std::ostringstream oss;
oss << std::endl;
std::string endlineSequence = oss.str();
bool isWindows = enlineSequence == "\r\n";
bool isOldMac = endlineSequence == "\r";
bool isUnix = endlineSequence == "\n";
// Will this work???
}