please provide some info about the actual write process and why you need it.
simply writing a textfile might not be the best way if you wanna use the info with some other script or program.
if you want the file for logging purposes only, then it's another deal.
_________________________
!

download KiXnet