Difference between revisions of "Bfile GetMediaFree OS"

From WikiPrizm
Jump to navigationJump to search
(Created page with "{{syscall | name = Bfile_GetMediaFree_OS | header = fxcg/file.h | signature = int Bfile_GetMediaFree_OS(unsigned short* media_id, int* freespace) | index = 0x1DA5 | parameters...")
 
 
Line 8: Line 8:
 
| returns = 0 on success or a negative error code on failure.
 
| returns = 0 on success or a negative error code on failure.
 
| synopsis = Gets the amount of free space on a device (the storage memory).
 
| synopsis = Gets the amount of free space on a device (the storage memory).
 +
| comments = {{BfileTimersWarning}}
 
| example = Here's how to get the amount of free bytes on the storage memory:
 
| example = Here's how to get the amount of free bytes on the storage memory:
 
  <nowiki>
 
  <nowiki>

Latest revision as of 08:59, 30 July 2014


Synopsis

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).

Parameters

  • 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.

Returns

0 on success or a negative error code on failure.

Comments

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.

Example

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.