Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Anchor10916881091688 Creating New Files and Directories Anchor10916891091689A new file can be created using FSFile_Open() or fs_fopen(), if opened in write or append mode. There are a few other ways that new files can be created (most of which also apply to new directories).anchor

10916901091690The simplest is the FSEntry_Create() function, which just makes a new file or directory: Anchor10964691096469  

...

rowspan4

...

Anchor10916951091695If the second argument, entry_type, is FS_ENTRY_TYPE_DIR the new entry will be a directory. The third argument, excl, indicates whether the creation should be exclusive. If it is exclusive (excl is DEF_YES), nothing will happen if the file already exists. Otherwise, the file currently specified by the file name will be deleted and a new empty file with that name created.anchor

10916961091696Similar functions exist to copy and rename an entry: Anchor10964771096477  

...

rowspan8

...

Anchor10917051091705

FSEntry_Copy() can only be used to copy files. The first two arguments of each of these are both full paths; the second path is not relative to the parent directory of the first. As with FSEntry_Create(), the third argument of each, excl, indicates whether the creation should be exclusive. If it is exclusive (excl is DEF_YES), nothing will happen if the destination or new file already exists.