【问题标题】:How to clean garbage fom begining of string stl string c++如何从字符串 stl string c++ 的开头清除垃圾
【发布时间】:2011-11-29 13:46:41
【问题描述】:

我正在从文件中读取简单的字符串,但是当我看到变量值时,我一直看到垃圾 怎么清洗?

string line;
ifstream fp_in;  // declarations of streams fp_in and fp_out
fp_in.open("test.txt",std::ios_base::in);    // open the streams
if(fp_in.is_open())
{
    while ( !fp_in.eof() )
        {       
        getline (fp_in,line,'\n');
...
...

但在“line”字符串的乞求中,我看到了: ן»¿{"数据":[{"id":"19513xxxx46141_326xxxx15447", ......
我怎样才能摆脱它?

【问题讨论】:

    标签: c++ string std garbage


    【解决方案1】:
    猜你喜欢
    • 1970-01-01
    • 2010-11-22
    • 1970-01-01
    • 2013-01-02
    • 2010-09-09
    • 1970-01-01
    • 1970-01-01
    • 2015-02-03
    • 2023-03-23
    相关资源
    最近更新 更多