Gets the remaining capacity of the file system.

Syntax

unsigned long CoreLeft(void);

Parameters

None

Return value

Returns the remaining capacity of the file system in bytes.

Requirements

Header file:
lib.h
Library file:
libSTARTUPOPH5000.a

Sample

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "lib.h"


void main(void)
{
    char data[11];
    FILE *fp;

    memset( data, 0x00, sizeof( data ));
    memcpy( data, "AAAAAAAAAA", 10 );
    printf("Mem: %lu\n", CoreLeft());
    if( ( fp = fopen( "TEST.TXT", "w") ) != NULL )
    {
        fwrite( data, 10, 1, fp );
        fclose( fp );
    }

    printf("Mem: %lu\n", CoreLeft());

    remove( "TEST.TXT" );
    Delay(TIME_100MS*30);     // wait for 3 seconds
    printf("Mem: %lu\n", CoreLeft());

    for (;;)
    {
        Idle();
    }
}

Last updated: 2020/11/18