• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Read CSV in a map

 
Manzoor Elahi
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I have a CSV file as below

VALUE 1A , VALUE 1B
VALUE 2A , VALUE 2B
VALUE 3A , VALUE 3B
etc

i need to store the values in a map as a key value pair, map<VALUE1A , VALUE1B>so on, so that i can process it further.

Can someone please help me how to do it. I end up inserting same values as both the key and value.

If someone can provide a code snippet it would be really helpful

TIA

Manzoor
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instead of implementing your own CSV parser (which isn't quite as trivial as it seems at first), I'd use one of the existing libraries; see AccessingFileFormats for links to some of them.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic