I have a csv file of the following type (more than only three line, this is just that you get the idea):
0000000000005791;Output_0000000000005791_RectImgLeft.bmp;Output_0000000000005791_RectImgRight.bmp
0000000000072517;Output_0000000000072517_RectImgLeft.bmp;Output_0000000000072517_RectImgRight.bmp
0000000000137939;Output_0000000000137939_RectImgLeft.bmp;Output_0000000000137939_RectImgRight.bmp
Note: There is no ";" at the end of each line.
I'd like to store the second and third string after the ";" in a string img1
and string img2
and iterate over each row of the csv file, so something like this:
ifstream read_file ( "file.csv" )
while ( read_file.good() ){
string img1 = get_string_after_first_semicolon;
string img2 = get_string_after_second_semicolon;
do_stuff(img1, img1)
}
In the first iteration the strings stored in img1
and img2
shall be
img1 = "Output_0000000000005791_RectImgLeft.bmp"
img2 = "Output_0000000000005791_RectImgRight.bmp"
in the second iteration
img1 = "Output_0000000000072517_RectImgLeft.bmp"
img2 = "Output_0000000000072517_RectImgRight.bmp"
and so forth...
As I've never worked with csv files I don't know how to evaluate each line and each string after a ";".