Production mechanisms of charm hadrons in the string model