]>
Commit | Line | Data |
---|---|---|
53668523 L |
1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\r |
2 | <html lang="en">\r | |
3 | <head>\r | |
289f6a14 | 4 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8">\r |
53668523 L |
5 | <meta http-equiv="Content-Style-Type" content="text/css">\r |
6 | <link rel="up" title="FatFs" href="../00index_e.html">\r | |
7 | <link rel="alternate" hreflang="ja" title="Japanese" href="../ja/rename.html">\r | |
8 | <link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">\r | |
9 | <title>FatFs - f_rename</title>\r | |
10 | </head>\r | |
11 | \r | |
12 | <body>\r | |
13 | \r | |
14 | <div class="para func">\r | |
15 | <h2>f_rename</h2>\r | |
70702af1 | 16 | <p>The f_rename function renames and/or moves a file or sub-directory.</p>\r |
53668523 L |
17 | <pre>\r |
18 | FRESULT f_rename (\r | |
19 | const TCHAR* <span class="arg">old_name</span>, <span class="c">/* [IN] Old object name */</span>\r | |
20 | const TCHAR* <span class="arg">new_name</span> <span class="c">/* [IN] New object name */</span>\r | |
21 | );\r | |
22 | </pre>\r | |
23 | </div>\r | |
24 | \r | |
25 | <div class="para arg">\r | |
26 | <h4>Parameters</h4>\r | |
27 | <dl class="par">\r | |
28 | <dt>old_name</dt>\r | |
70702af1 | 29 | <dd>Pointer to a null-terminated string that specifies the existing <a href="filename.html">file or sub-directory</a> to be renamed.</dd>\r |
53668523 | 30 | <dt>new_name</dt>\r |
70702af1 | 31 | <dd>Pointer to a null-terminated string that specifies the new object name. A drive number may be specified in this string but it is ignored and assumed as the same drive of the <tt class="arg">old_name</tt>. Any object with this path name except <tt class="arg">old_name</tt> must not be exist, or the function fails with <tt>FR_EXIST</tt>.</dd>\r |
53668523 L |
32 | </dl>\r |
33 | </div>\r | |
34 | \r | |
35 | \r | |
36 | <div class="para ret">\r | |
37 | <h4>Return Values</h4>\r | |
38 | <p>\r | |
39 | <a href="rc.html#ok">FR_OK</a>,\r | |
40 | <a href="rc.html#de">FR_DISK_ERR</a>,\r | |
41 | <a href="rc.html#ie">FR_INT_ERR</a>,\r | |
42 | <a href="rc.html#nr">FR_NOT_READY</a>,\r | |
43 | <a href="rc.html#ok">FR_NO_FILE</a>,\r | |
44 | <a href="rc.html#np">FR_NO_PATH</a>,\r | |
45 | <a href="rc.html#in">FR_INVALID_NAME</a>,\r | |
53668523 L |
46 | <a href="rc.html#ex">FR_EXIST</a>,\r |
47 | <a href="rc.html#wp">FR_WRITE_PROTECTED</a>,\r | |
48 | <a href="rc.html#id">FR_INVALID_DRIVE</a>,\r | |
49 | <a href="rc.html#ne">FR_NOT_ENABLED</a>,\r | |
50 | <a href="rc.html#ns">FR_NO_FILESYSTEM</a>,\r | |
51 | <a href="rc.html#tm">FR_TIMEOUT</a>,\r | |
52 | <a href="rc.html#lo">FR_LOCKED</a>,\r | |
53 | <a href="rc.html#nc">FR_NOT_ENOUGH_CORE</a>\r | |
54 | </p>\r | |
55 | </div>\r | |
56 | \r | |
57 | \r | |
58 | <div class="para desc">\r | |
59 | <h4>Description</h4>\r | |
70702af1 | 60 | <p>Renames a file or sub-directory and can also move it to other directory in the same volume. The object to be renamed must not be an open object, or <em>the FAT volume can be collapsed</em>. Such the wrong operation is rejected safely when <a href="appnote.html#dup">file lock function</a> is enabled.</p>\r |
53668523 L |
61 | </div>\r |
62 | \r | |
63 | \r | |
64 | <div class="para comp">\r | |
65 | <h4>QuickInfo</h4>\r | |
289f6a14 | 66 | <p>Available when <tt><a href="config.html#fs_readonly">FF_FS_READONLY</a> == 0</tt> and <tt><a href="config.html#fs_minimize">FF_FS_MINIMIZE</a> == 0</tt>.</p>\r |
53668523 L |
67 | </div>\r |
68 | \r | |
69 | \r | |
70 | <div class="para use">\r | |
71 | <h4>Example</h4>\r | |
72 | <pre>\r | |
70702af1 | 73 | <span class="c">/* Rename an object in the default drive */</span>\r |
289f6a14 | 74 | <em>f_rename</em>("oldname.txt", "newname.txt");\r |
53668523 | 75 | \r |
70702af1 | 76 | <span class="c">/* Rename an object in the drive 2 */</span>\r |
289f6a14 | 77 | <em>f_rename</em>("2:oldname.txt", "newname.txt");\r |
70702af1 | 78 | \r |
289f6a14 L |
79 | <span class="c">/* Rename an object and move it to another directory in the drive */</span>\r |
80 | <em>f_rename</em>("log.txt", "old/log0001.txt");\r | |
53668523 L |
81 | </pre>\r |
82 | </div>\r | |
83 | \r | |
84 | \r | |
85 | <p class="foot"><a href="../00index_e.html">Return</a></p>\r | |
86 | </body>\r | |
87 | </html>\r |