By default serial port is the standard output device,how to change it to a controller Port0
Isn't that in the manual?
http://www.keil.com/support/man/docs/c51/c51_lib_stream.htm
It even tells you where to find the source code!