I really don't understand what you are doing.
#ifdef FTPWRITE
fh = SD.open(fileName,FILE_WRITE);
#else
fh = SD.open(fileName,FILE_WRITE);
#endif
If the name FTPWRITE is defined, open a file for write. If it isn't defined, open the same file, the same way. What is the purpose of the conditionals?
fh = SD.open(fileName,FILE_WRITE);
fh.println("*****random*****");
fh.close();
Unconditionally open the file that is already open. Write the string containing random, which is anything but random, and then close the file.
The fine folks at http://snippets-r-us.com might be able to help you with your snippets.