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/chdrive.html">
8e6865dcdSopenharmony_ci<link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
9e6865dcdSopenharmony_ci<title>FatFs - f_chdrive</title>
10e6865dcdSopenharmony_ci</head>
11e6865dcdSopenharmony_ci
12e6865dcdSopenharmony_ci<body>
13e6865dcdSopenharmony_ci
14e6865dcdSopenharmony_ci<div class="para func">
15e6865dcdSopenharmony_ci<h2>f_chdrive</h2>
16e6865dcdSopenharmony_ci<p>The f_chdrive function changes the current drive.</p>
17e6865dcdSopenharmony_ci<pre>
18e6865dcdSopenharmony_ciFRESULT f_chdrive (
19e6865dcdSopenharmony_ci  const TCHAR* <span class="arg">path</span>  <span class="c">/* [IN] Logical drive number */</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>Specifies the <a href="filename.html">logical drive number</a> to be set as the current drive.</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#id">FR_INVALID_DRIVE</a>
38e6865dcdSopenharmony_ci</p>
39e6865dcdSopenharmony_ci</div>
40e6865dcdSopenharmony_ci
41e6865dcdSopenharmony_ci
42e6865dcdSopenharmony_ci<div class="para desc">
43e6865dcdSopenharmony_ci<h4>Description</h4>
44e6865dcdSopenharmony_ci<p>The <tt>f_chdrive</tt> function changes only the current drive. The initial value of the current drive number is 0. In Unix style drive prefix configuration, this function will not be needed because <tt>f_chdir</tt> function changes also the current drive. Note that the current drive is retained in a static variable, so that it also affects other tasks that using the file functions.</p>
45e6865dcdSopenharmony_ci</div>
46e6865dcdSopenharmony_ci
47e6865dcdSopenharmony_ci<div class="para comp">
48e6865dcdSopenharmony_ci<h4>QuickInfo</h4>
49e6865dcdSopenharmony_ci<p>Available when <tt><a href="config.html#fs_rpath">FF_FS_RPATH</a> &gt;= 1</tt>.</p>
50e6865dcdSopenharmony_ci</div>
51e6865dcdSopenharmony_ci
52e6865dcdSopenharmony_ci
53e6865dcdSopenharmony_ci<div class="para use">
54e6865dcdSopenharmony_ci<h4>Example</h4>
55e6865dcdSopenharmony_ci<pre>
56e6865dcdSopenharmony_ci    <em>f_chdrive</em>("2:");  <span class="c">/* Set drive 2 as current drive */</span>
57e6865dcdSopenharmony_ci
58e6865dcdSopenharmony_ci    <em>f_chdrive</em>("");    <span class="c">/* No effect (set current drive as current drive) */</span>
59e6865dcdSopenharmony_ci</pre>
60e6865dcdSopenharmony_ci</div>
61e6865dcdSopenharmony_ci
62e6865dcdSopenharmony_ci
63e6865dcdSopenharmony_ci<div class="para ref">
64e6865dcdSopenharmony_ci<h4>See Also</h4>
65e6865dcdSopenharmony_ci<p><tt><a href="chdir.html">f_chdir</a>, <a href="getcwd.html">f_getcwd</a></tt></p>
66e6865dcdSopenharmony_ci</div>
67e6865dcdSopenharmony_ci
68e6865dcdSopenharmony_ci<p class="foot"><a href="../00index_e.html">Return</a></p>
69e6865dcdSopenharmony_ci</body>
70e6865dcdSopenharmony_ci</html>
71