1e6865dcdSopenharmony_ci<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2e6865dcdSopenharmony_ci<html lang="en">
3e6865dcdSopenharmony_ci<head>
4e6865dcdSopenharmony_ci<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5e6865dcdSopenharmony_ci<meta http-equiv="Content-Style-Type" content="text/css">
6e6865dcdSopenharmony_ci<link rel="up" title="FatFs" href="../00index_e.html">
7e6865dcdSopenharmony_ci<link rel="alternate" hreflang="ja" title="Japanese" href="../ja/chdir.html">
8e6865dcdSopenharmony_ci<link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
9e6865dcdSopenharmony_ci<title>FatFs - f_chdir</title>
10e6865dcdSopenharmony_ci</head>
11e6865dcdSopenharmony_ci
12e6865dcdSopenharmony_ci<body>
13e6865dcdSopenharmony_ci
14e6865dcdSopenharmony_ci<div class="para func">
15e6865dcdSopenharmony_ci<h2>f_chdir</h2>
16e6865dcdSopenharmony_ci<p>The <tt>f_chdir</tt> function changes the current directory of the logical drive.</p>
17e6865dcdSopenharmony_ci<pre>
18e6865dcdSopenharmony_ciFRESULT f_chdir (
19e6865dcdSopenharmony_ci  const TCHAR* <span class="arg">path</span> <span class="c">/* [IN] Path name */</span>
20e6865dcdSopenharmony_ci);
21e6865dcdSopenharmony_ci</pre>
22e6865dcdSopenharmony_ci</div>
23e6865dcdSopenharmony_ci
24e6865dcdSopenharmony_ci<div class="para arg">
25e6865dcdSopenharmony_ci<h4>Parameters</h4>
26e6865dcdSopenharmony_ci<dl class="par">
27e6865dcdSopenharmony_ci<dt>path</dt>
28e6865dcdSopenharmony_ci<dd>Pointer to the null-terminated string that specifies the <a href="filename.html">directory</a> to be set as current directory.</dd>
29e6865dcdSopenharmony_ci</dl>
30e6865dcdSopenharmony_ci</div>
31e6865dcdSopenharmony_ci
32e6865dcdSopenharmony_ci
33e6865dcdSopenharmony_ci<div class="para ret">
34e6865dcdSopenharmony_ci<h4>Return Values</h4>
35e6865dcdSopenharmony_ci<p>
36e6865dcdSopenharmony_ci<a href="rc.html#ok">FR_OK</a>,
37e6865dcdSopenharmony_ci<a href="rc.html#de">FR_DISK_ERR</a>,
38e6865dcdSopenharmony_ci<a href="rc.html#ie">FR_INT_ERR</a>,
39e6865dcdSopenharmony_ci<a href="rc.html#nr">FR_NOT_READY</a>,
40e6865dcdSopenharmony_ci<a href="rc.html#np">FR_NO_PATH</a>,
41e6865dcdSopenharmony_ci<a href="rc.html#in">FR_INVALID_NAME</a>,
42e6865dcdSopenharmony_ci<a href="rc.html#id">FR_INVALID_DRIVE</a>,
43e6865dcdSopenharmony_ci<a href="rc.html#ne">FR_NOT_ENABLED</a>,
44e6865dcdSopenharmony_ci<a href="rc.html#ns">FR_NO_FILESYSTEM</a>,
45e6865dcdSopenharmony_ci<a href="rc.html#tm">FR_TIMEOUT</a>,
46e6865dcdSopenharmony_ci<a href="rc.html#nc">FR_NOT_ENOUGH_CORE</a>
47e6865dcdSopenharmony_ci</p>
48e6865dcdSopenharmony_ci</div>
49e6865dcdSopenharmony_ci
50e6865dcdSopenharmony_ci
51e6865dcdSopenharmony_ci<div class="para desc">
52e6865dcdSopenharmony_ci<h4>Description</h4>
53e6865dcdSopenharmony_ci<p>The <tt>f_chdir</tt> function changes the current directory of the logical drive. Also the current drive will be changed when in Unix style drive prefix, <tt><a href="config.html#str_volume_id">FF_STR_VOLUME_ID</a> == 2</tt>. The current directory of each logical drive is initialized to the root directory on mount.</p>
54e6865dcdSopenharmony_ci<p>Note that the current directory is retained in the each file system object and the current drive is retained in a static variable, so that it also affects other tasks that use the file functions.</p>
55e6865dcdSopenharmony_ci</div>
56e6865dcdSopenharmony_ci
57e6865dcdSopenharmony_ci
58e6865dcdSopenharmony_ci<div class="para comp">
59e6865dcdSopenharmony_ci<h4>QuickInfo</h4>
60e6865dcdSopenharmony_ci<p>Available when <tt><a href="config.html#fs_rpath">FF_FS_RPATH</a> &gt;= 1</tt>.</p>
61e6865dcdSopenharmony_ci</div>
62e6865dcdSopenharmony_ci
63e6865dcdSopenharmony_ci
64e6865dcdSopenharmony_ci<div class="para use">
65e6865dcdSopenharmony_ci<h4>Example</h4>
66e6865dcdSopenharmony_ci<pre>
67e6865dcdSopenharmony_ci    <span class="c">/* Change current direcoty of the current drive ("dir1" under root directory) */</span>
68e6865dcdSopenharmony_ci    <em>f_chdir</em>("/dir1");
69e6865dcdSopenharmony_ci
70e6865dcdSopenharmony_ci    <span class="c">/* Change current direcoty of current drive (parent directory of drive 2) */</span>
71e6865dcdSopenharmony_ci    <em>f_chdir</em>("2:..");
72e6865dcdSopenharmony_ci
73e6865dcdSopenharmony_ci    <span class="c">/* Change current direcoty of the drive "sdcard" (at DOS/Windows style volume ID) */</span>
74e6865dcdSopenharmony_ci    <em>f_chdir</em>("sdcard:/dir1");
75e6865dcdSopenharmony_ci
76e6865dcdSopenharmony_ci    <span class="c">/* Change current direcoty of the drive "flash" and set it as current drive (at Unix style volume ID) */</span>
77e6865dcdSopenharmony_ci    <em>f_chdir</em>("/flash/dir1");
78e6865dcdSopenharmony_ci</pre>
79e6865dcdSopenharmony_ci</div>
80e6865dcdSopenharmony_ci
81e6865dcdSopenharmony_ci<div class="para ref">
82e6865dcdSopenharmony_ci<h4>See Also</h4>
83e6865dcdSopenharmony_ci<p><tt><a href="chdrive.html">f_chdrive</a>, <a href="getcwd.html">f_getcwd</a></tt></p>
84e6865dcdSopenharmony_ci</div>
85e6865dcdSopenharmony_ci
86e6865dcdSopenharmony_ci<p class="foot"><a href="../00index_e.html">Return</a></p>
87e6865dcdSopenharmony_ci</body>
88e6865dcdSopenharmony_ci</html>
89