I have a small project that I'm working on were I need to read a csv file. The file has 3 rows, this first column in each row has a unique name that I would like to use to select that entire row and copy to a new file. The thought is hopefully this can be done with a larger number of rows.
Has anyone encountered this before, know how it could be done or any examples?
I have searched quite a bit but get some conflicting ways.
Since you are new to C++ I would suggest to start small.
Write a simple program that can read all the 3 lines from the file and display them on the console.
Hi, Thanks for your reply. I have just successfully done this. Now I need to work out how to select each row that contains the key word and write them to a new file.
OK, now you read the first column of each line and use this value as the filename for the outputfile.
To read the first column you could use the string.find / str.substr method or getline with delimiter.
Then you write the line to the outputfile.