Bfile GetMediaFree OS

From WikiPrizm
Revision as of 08:59, 30 July 2014 by Gbl08ma (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search


Header: fxcg/file.h
Syscall index: 0x1DA5
Function signature: int Bfile_GetMediaFree_OS(unsigned short* media_id, int* freespace)

Gets the amount of free space on a device (the storage memory).


  • unsigned short* media_id - Pointer to a 16 bit string with the device identifier (\\fls0).
  • int* freespace - Pointer to int that will hold the amount of free bytes on the device.


0 on success or a negative error code on failure.


Using Bfile functions while user timers are installed can cause SYSTEM ERRORs and other undefined behavior, especially with functions that change data on the file system. Make sure to stop and uninstall all timers before using Bfile functions (and optionally restore them later). See Incompatibility between Bfile Syscalls and Timers for more information.


Here's how to get the amount of free bytes on the storage memory:

int smemfree;
unsigned short smemMedia[10]={'\\','\\','f','l','s','0',0};
Bfile_GetMediaFree_OS( smemMedia, &smemfree );
// the free space in bytes on the storage memory is now on smemfree.