In quale file vuoi scrivere? .doc .txt???
Cmq per scrivere in un altro file vanno bene entrambi i metodi da te citati...