Arduino Ethernet Shield SD Hangs


I have a project that is using the SD card on the official Arduino Ethernet Shield. It was working fine, but not any more. Now it hangs on the declaration of a file:

File file_CODES ="CODES.txt");

The SD card is initialised successfully. If I try to list the files on the card I don't have problem. I haven't changed any libraries. I've formated the card on the computer and still no change. Any ideas what else I can check.

I found the problem. If the sketch is more that 21650 bytes, I cannot open the file. Any ideas why this is happenig? I think the max is 30720.

Binary sketch size: 21652 bytes (of a 30720 byte maximum)

Perhaps you have run out of RAM? (I'm assuming the larger the code the more RAM it might be using - not necessarily the case)