LinkIt A-Core files read and delete

Hello, I using the A-Core to receive sms messages that I am storing in simple files, this work well, each sms has it’s own file,
I am encountering a problem when trying to read them all or delete them with this code.

Read them code

[code]LFile entry;
while(true){
entry=root.openNextFile();
if (! entry) break;

andrei.ai [2:46 PM]
while(entry=root.openNextFile()){

}[/code]

Remove all code

void remove_non_inbox_files(){ LFile root = Drv.open("/Inbox"); LFile entry; SeeedOled.setTextXY(0,0); SeeedOled.setHorizontalMode(); while(true){ entry=root.openNextFile(); if (! entry) break; char filepath[50]; strcpy(filepath,"/Inbox/"); strcat(filepath, entry.name()); SeeedOled.putString(filepath); SeeedOled.putString("\n"); bool deleted = Drv.remove(filepath); if (delete) // if(strcmp(entry.name(),"") != 0 && !entry.isDirectory()){ // Drv.remove(entry.name()); // } delay(1000); } SeeedOled.putString(" All Inbox files removed ! "); delay(2000); }

Both codes crash the board, putting the red leds on the back in alternative blinking. Any other ideas of how to read a series of files and delete them after if needed?

Could there be a problem with retrieving files from the Linkit A-Core? Did anyone succeeded to delete any file off the memory?

Thank you.