Read and Search a CSV file

hi. i know my question is a basic one, but i am a noob when it comes to c++. now, how do i search a csv file?. e.g. i will enter an employee id and it will return the name and address of that employee id. thank you
Removed
Last edited on
> i will enter an employee id and it will return the name and address of that employee id.

If you are going to do this repeatedly, read the file once and populate an associative array with the employee id as the key.
http://www.cplusplus.com/reference/stl/map/

Parsing a csv file correctly could get slightly tricky with quoted strings and the like - perhaps you should let boost::escaped_list_separator<> do the parsing for you.
http://www.boost.org/doc/libs/1_49_0/libs/tokenizer/escaped_list_separator.htm
Topic archived. No new replies allowed.