I wrote this code to send info as (state, college, teacher) from the server to the client. I am running a script which will dump all the info about (state, college and teacher) into a file with a special symbol (#,$,%).When a client needs a list of states, a list of states of a college, or a list of colleges of a teacher, I will get it from a file with the help of a separate (#,$,%). My script is good here for doing this stuff.  I would appreciate remarks and critique on better string parsing, best error handling case, and any other suggestions to improve the code.This is the server code:std::string StateName,StateCollege,CollegeTeacher;// Createing a map so that when a client send state name .this map will return all the register college name. std::map<std::string, std::vector<std::string>> StateCollegeMap;    // Creating a map so that when a client send state and college name ,this map return all the teacher name of the college to a clientstd::map< std::pair<std::string , std::string> , std::vector<std::string> > CollegeTeacherMap;// these are the vecctor will be shared with client.std::vector< std::string >ReturnStateName;std::vector< std::string >ReturnStateCollege;std::vector< std::string >ReturnCollegeTeacher;//This funtion Extract the name of state,college,teacher base on the string(ie each line from file) recived form a filevoid FilterOnlyName(std::string & input){    auto pos = input.find_last_of('*');    if(pos != std::string::npos) {        input.erase(0, pos + 1);        pos = input.find_first_of(' ');        if(pos != std::string::npos)            input.erase(pos);    }}// **GetAllStateName,GetAllStateCollegeName,GetCollegeTeacherName is called by client with key  and i return the key value as below** class myhandler::public clientlibHandler() {public:            void GetAllStateName()            {                SendToClient::GetAllStateName();                for(auto iter=ReturnStateName.begin();iter<ReturnStateName.end();iter++)                {                    ReturnStateName.push_back(*iter);                   }            }            void GetAllStateCollegeName(std::string & state)            {                for(auto val : StateCollegeMap[state])                {                    ReturnStateCollege.push_back(val);                }            }            void GetCollegeTeacherName(Std::string & state,std::string &college)            {                auto particularKey = std::make_pair(state,college);                for(auto val : CollegeTeacherMap[particularKey])                {                    ReturnCollegeTeacher.push_back(val);                    }                   }}namespace SendToClient{    void GetAllStateName()    {      // Need to clear since multiple call to GetAllStateName will contain old map         if(!CollegeTeacherMap.empty())        {            cout<<Cleaning the map<<endl;            CollegeTeacherMap.clear();        }        if(!CollegeTeacherMap.empty())        {            cout<<cleaning the map<<endl;            CollegeTeacherMap.clear();        }        char *temporary = tempnam(/tmp, country);        if (temporary != NULL)        {            char FormCommand[MAX_LEN] = {0};            sprintf(FormCommand, Script_State_College_Teacher > %s, temporary);    //This script will write all the State ,college,teacher name separated by symbol(#,$,%) into the file.                                       system(FormCommand);            std::ifstream fin(teporary);            std::string fullLine;        //read line and map a map             while (getline(fin, fullLine))            {                // @ means its a StateName                if (fullLine[0] != '#')                 {                    StateName=fullLine;                    FilterOnlyName(StateName);                    ReturnStateName.push_back(StateName);                }                // $ means CollegeName                else if (fullLine[1] == '$')                {                    StateCollege=fullLine;                    FilterOnlyName(StateCollege);                    //Creating map where  state name is key and StateCollege Name is Value                                          StateCollegeMap[StateName].push_back(StateCollege);                }                //  teacher Name                else if (fullLine[1] == '$' && fullLine[2] != '%')                {                    CollegeTeacher=fullLine;                    FilterOnlyName(CollegeTeacher);                    //Creating a map where State Name and State college is key and college teacher name is value.                    CollegeTeacherMap[std::make_pair(StateName,StateCollege)].push_back(CollegeTeacher);                }            }        }        else        {            std::cout << FILE CREATION FAILED << std::endl;        }        remove(temporary);    }}
Sending info (state, college, teacher) to client based on the request received by the server
c++;strings;vectors;hash map