Emi*_*ier 6 c++ newline stringstream end-of-line
我们知道,当插入\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???
}
Run Code Online (Sandbox Code Playgroud)
Bjö*_*lex 15
系统特定的行结尾仅与文本文件相关.只要流只在内存中,它就是'\n'.
| 归档时间: |
|
| 查看次数: |
15087 次 |
| 最近记录: |