Click here to Skip to main content
11,435,407 members (50,593 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++
HI,

I have the text file as follows

Name="AA",DOB="01/jan",Address="India"
Name="BB",DOB="01/jan",Address="India"
Name="CC",DOB="01/Feb",Address="India",Mobile="XXXX"
Name="DD",DOB="01/Mar",Address="India",Mobile="XXXX"

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

Thanks in advance.
Posted 11-Oct-12 0:10am
Edited 11-Oct-12 0:18am
v2
Rate this: bad
good
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.
  Permalink  
v2
Rate this: bad
good
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
  Permalink  

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



Advertise | Privacy | Mobile
Web04 | 2.8.150428.2 | Last Updated 11 Oct 2012
Copyright © CodeProject, 1999-2015
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