You can't use malloc() to allocate c++ objects like std::string, but use the new operator. This is more than likely the cause of your program crashing.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
you don't specifically allocate memory for the string object because it is not a pointer inside the structure. Just allocate tmp and everything will be allocated ok tmp = new edge;
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343