Bfile CreateEntry OS

From WikiPrizm
Revision as of 20:58, 9 June 2012 by Tari (talk | contribs)
Jump to navigationJump to search


Synopsis

Header: Not documented
Syscall index: Not documented
Function signature: int Bfile_CreateEntry_OS(const unsigned short* filename, int mode, int *size);

Creates a file or folder in storage memory.

Parameters

  • filename - A 16 bit character array, most likely generated by Bfile_StrToName_ncpy.
  • mode - Used to determine whether a file or folder will be made.
  • size - A pointer to the size of the file, NULL if making a folder.

Returns

0 on success, or a negative error code on failure.

Comments

Does not return a handle for created files. Use Bfile_OpenFile_OS after a successful creation.

The following are the modes that can be used:

  • 1 - CREATEMODE_FILE - Makes a file using the size provided.
  • 5 - CREATEMODE_FOLDER - Makes a folder. Size should be NULL.

This function is a combination of fopen's file creation and mkdir. Please note that the size of the file must be set upon creation. Files are not dynamically resizable. If you expect to be resizing a file while writing, it is preferred to use the main memory.