Please don't post the same question to multiple forums. It just wastes people's time -- and it's like littering! You're new around here, so I'm going to let you off with a warning. I've deleted the four (!) other copies you posted; please don't do it again.
To answer your question: there's no portable way to do this, but if your machine supports ANSI control sequences, you can use those, as described here.