i did such a code, but sorry may be I am bit selfish but I will not give it to you just like this.
But what i can is to give you link to pages where there are described some ways hove to do it yourself:
http://www.policyalmanac.org/games/aStarTutorial.htm
I used it to create my own pathfinding code. read it carefuly few times to be sure you understand whats about and then go and code it yourself. there are les and more dificult ways hove to do it described so I recomend you to start with easy one.
One more thing -you have to split your map in to tilles even if its real time game. But thats no problem normaly.
Good luck...