Leonardo mass storage using onboard flash example?

Hi, are there any code examples out there for the Leonardo acting as a mass storage device without external flash or SD card? Maybe just a text file stored somehow in flash memory. Thanks!

The FLASH can’t be changed by the running sketch. At least that is true of the UNO. You can store some data in the EEPROM.

Not much in the way of mass storage, but it could be done as a read only serial device.
Something along the lines of:

/*  War And Peace */

#include <avr/pgmspace.h>
char  synopsis[] PROGMEM = "Insert synopsis of War and Peace here";
const char *WarAndPeace PROGMEM = {synopsis};

char buffer[1024]; 

void setup() {
  Serial.begin(9600);
  while (Serial.available() == 0);
  for (int I = 0, I < 24; I++ )    // change uper bound as required 
    { for (int J = 0; J < 1024; J++) 
      { strcpy_P(buffer, (char*)pgm_read_word(&(WarAndPeace[(I*1024)+J])));
        Serial.print( buffer[J] );
      }
    }    
}
void loop() {}

Probably several mistakes in my code.
I think that it would be better to buy a USB memory stick.

The easiest way would be to add an SPI or Parallel Flash IC and have the Leonardo interface that with the computer.