Writing to a file in the setup() function

Hey everyone,
How can I create/read/write to a file within the setup() function? I am using the Arduino BT and am new to this and having a hard time.
Thanks.

-Team3

I think you have not got your embedded head on. We don't write to files on this platform. We can do serial print or store things in arrays or variables but files no. Where is the file going to be stored?
Unless you go for an external memory shield there is no place to put a file.

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?

Check this out:

It does not matter if the "read/write" is inside setup() or inside loop(), as long as Serial.begin() was called before you start calling Serial.print().

I hope this is what you are looking for.