Writing to a file in the setup() function

Grumpy_Mike is entirely right, the arduino itself doesn't really have files.

If you wanted to have the arduino hooked up to a computer, and save files on that computer, you'll have to write a seperate program on the computer and interface them together. See Arduino Playground - InterfacingWithSoftware

If you were planning on having the arduino stand alone, and keep some data 'permanently' (between power cycles), you can write a tiny bit of data to the EEPROM. see http://www.arduino.cc/en/Tutorial/Memory and http://www.arduino.cc/en/Reference/EEPROM

If you wanted to have a memory card attached to the arduino, that would require interfacing with that card.

What is it that you're trying to do?