Versions Compared

Key

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

...

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

Code Block
languagecpp
    FSEntry_Create("\\file.txt",           /* file name                           */
                    FS_ENTRY_TYPE_FILE,    /* means entry will be a file          */
                    DEF_NO,                /* DEF_NO means creation NOT exclusive */
                   &err);                  /* return error                        */


I
f 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.

Similar functions exist to copy and rename an entry:

Code Block
   FSEntry_Copy("\\dir\\src.txt",         /* source file name                    */
                "\\dir\\dest.txt »,       /* destination file name               */
                 DEF_NO,                  /* DEF_NO means creation not exclusive */
                &err);                    /* return error                        */ 
   FSEntry_Rename ("\\dir\\oldname.txt",  /* old file name                       */
                   "\\dir\\newname.txt",  /* new file name                       */
                    DEF_NO,               /* DEF_NO means creation not exclusive */
                   &err);                 /* return error                        */


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
.