member `file_line` is not actually used for normal logic inside LineReader, making set_file_line effectively useless
Closed this issue · 1 comments
Cazadorro commented
Needed to set the line in a csv file,
io::CSVReader<1> csv_file(file_path);
csv_file.read_header(io::ignore_extra_column, "\"my_column\"");
unsigned int line_number = 3;
// +1 to avoid header
csv_file.set_file_line(line_number+1);
std::cout << "line_number + 1: " <<line_number + 1 << std::endl; //4
std::cout << "file line: " << csv_file.get_file_line() << std::endl; // 4
double my_column;
csv_file.read_row(my_column); //only reads first line.
std::cout << "file line: " << csv_file.get_file_line() << std::endl; //5 which is expected
csv_file.read_row(my_column); //but this will get the second line?, so there is some other variable handling the true line number.
Found out that, while line number itself is properly updated, no where in the next line function, or indeed in the entire csv.h header file does file_line actually correspond to internal logic, ie, it doesn't effect the actual line number underneath.
If this isn't correct, please correct me with the appropriate information, but AFAICT, it is only used for error handling, it doesn't effect the actual line I'm trying to read from the CSV file.
ben-strasser commented
Hi,
The line number is only used in the error messages and in the
get_file_line function.
Best Regards
Dr. Ben Strasser
…On 5/20/19 8:37 PM, Shae Bolt wrote:
Needed to set the line in a csv file,
|io::CSVReader<1> csv_file(file_path);
csv_file.read_header(io::ignore_extra_column, "\"my_column\"");
unsigned int line_number = 3; // +1 to avoid header
csv_file.set_file_line(line_number+1); std::cout << "line_number + 1:
" <<line_number + 1 << std::endl; //4 std::cout << "file line: " <<
csv_file.get_file_line() << std::endl; // 4 double my_column;
csv_file.read_row(my_column); //only reads first line. std::cout <<
"file line: " << csv_file.get_file_line() << std::endl; //5 which is
expected csv_file.read_row(my_column); //but this will get the second
line?, so there is some other variable handling the true line number. |
Found out that, while line number itself is properly updated, no where
in the next line function, or indeed in the entire csv.h header file
does file_line actually correspond to internal logic, ie, it doesn't
effect the actual line number underneath.
If this isn't correct, please correct me with the appropriate
information, but AFAICT, it is only used for error handling, it
doesn't effect the actual line I'm trying to read from the CSV file.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#80?email_source=notifications&email_token=AC3IBD2D2NCZDG5Y5OP2QCTPWLVVLA5CNFSM4HOENSXKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GUZJXHQ>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AC3IBD6HOCSIQ7MMNUJZZMLPWLVVLANCNFSM4HOENSXA>.