Home/Support/Support Forum/slow fflush on ME9210 - NetOs
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

slow fflush on ME9210 - NetOs

0 votes

I'm trying to make blank 32k file.
I open file, use seek function to go to end of file, write 0 and then execute fflush.

It takes almost 10 minutes to create blank 32k file.

Is there way to speed up and why is so slow?
asked Apr 2, 2014 in NET+OS by zaricd New to the Community (2 points)
edited Apr 2, 2014 by zaricd

What version of NET+OS?
What module are you running this on?
Are you writing to RAM (file system) or FLASH (file system)?
Thanks for answer , check my comment below.

Please log in or register to answer this question.

1 Answer

0 votes
can you post your code here?

Also can you tell me why are you doing this?
answered Apr 3, 2014 by tuxembb Veteran of the Digi Community (288 points)
I'm porting Sedona (sedonadev.org) virtual machine to NetOs 7.5 and ME9210, sedona creates one empty 32k file to use for histories. I can't change that because it is part of Sedona .

This is simple version how code looks, I tested this and takes a 5-10 min to flush this to drive, and program is stuck on fflush.

    FILE* fp;
    char* FileName="FLASH0/test.data";

    /* Initialize the system services for the application. */

    //delete file
    // create file
    printf ("Create File: %s",FileName);
    fp = fopen(FileName, "a+b");
    // open file
    fp = fopen(FileName, "r+b");
    // go to end
    fseek(fp, 32768, SEEK_SET);
    // write to end
    fputc(0x00, fp);
    // flush
    // close

Is there anyway you can replace the fseek, fputc and fflush with an fwrite and fflush. You can write 32kb of anything to FLASH in no time. I know you originally stated you can't but I figured I'd ask once more.