Skip to content

error when parsing numeric field for a specific file open by ifstream #272

@sangoblin

Description

@sangoblin

test.csv

all the datas under the column "ets" are intergers. However, if I choose to open the file using ifstream (the code is listed as below), the program will complain that the data field is not a number.

#include <csv.hpp>
#include
#include

using namespace std;
using csv::CSVReader, csv::CSVRow;

int main(int argc, const char** argv)
{
ifstream ifs("test.csv");

for (auto&& row : CSVReader{ifs})
{
    const auto ets= row["ets"].get<long>();
    cout << ets << endl;
}

}

However, if I read the csv by file name directly, i.e., CSVReader("test.csv"), the program could run normally.

Could you please kindly investigate this issue? Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions