Thanks guys,
I have replaced all my char array with string but the problem still persist.
As pointed out by Daved, I also removed the for() loop and change that part to:
In this case, calling the default constructor of the list also doesnt solve my problem.Code://id format is like this "crescent_0_1" char num; num = id->at(id->find_last_of('_')+1); vertex = atoi(&num); num = id->at(id->find_first_of('_')+1); segmentId = atoi(&num); roadname = id->substr(0, id->find_first_of('_'));