Click here to Skip to main content
12,549,332 members (47,767 online)
Rate this:
Please Sign up or sign in to vote.
See more: C++

I have the text file as follows


i want to read the above file and fill the map.
Can any one help in this with good idea.

Thanks in advance.
Posted 10-Oct-12 23:10pm
Updated 10-Oct-12 23:18pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Hi Durga_Devi,

Considering the forum's rules (as well the other forums too) we couldn't give you all the code coz it will be considered as doing somebody homework.

So here a link [^] for a good tutorial which may help you with your request (you may declare your map as follow map< string, string> dB;.

Good luck.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

The parsing would be fare and simple:
Every line Hold one information. This one probably end with \r\n or just \r, not possible to answer surely. Every line has more than one data, with variable length, and they are separated by comma. and every field has two part Type and data and data is enclosed by ".

Step 1:
Read every byte until you find end of line;

Step 2: here you have go a line
Now, you can create a two dimension array to hold separate the data. Various way can be applied for this.

Step 3:
Fill the map

Step 4:
Go to Step 1

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.161021.1 | Last Updated 11 Oct 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100