Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
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
Updated 10-Oct-12 23:18pm
v2

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.
 
Share this answer
 
v2
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
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900