I'm trying to read data from a file line by line and read some specific data from it and than store that data into c++ stl maps as a key value pair.
for example:- let's say we have a file raw_data.inc which consists of following data:-
//
This file consists data of players
Players data
#define David data(12345) //David's data
#define Mark data(13441) //Mark's data
Owners data
#define Sarah data(98383) //Sarah's data
#define Coner data(73834) //Coner's data
This is the end of the file
//
let's suppose all the above data is stored in the file which we want to read (assume forward slashes are also the part of data).
So what I want is to read some part of it(to be specific David
and 12345
) and store it into a c++ stl map as a key value pair
map <string,string> mp
and data will be stored as
mp[12345=>"David",13441=>"Mark",98383=>"Sarah",73834=>"Coner"];
So my question is, is it possible to do so? And if yes than how? Will the normal filestream of C++ will work?
Assume we don't know what is the datatype of the data stored in that file. File could be .h file or .cpp file or .inc file