linux读取Windows的txt文件问题

问题:Windows下生成的txt文件,在Linux下读取时会读取到多余字符(如: ^M)

原因:Windows和Linux下的换行符不一致

解决:在Linux代码中将多余字符去掉

if(buf.find("
") > 0)
  buf = buf.replace(buf.find("
"), 1, "");
原文地址:https://www.cnblogs.com/haiyang21/p/9335350.html