1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 2<html lang="en"> 3<head> 4<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 5<meta http-equiv="Content-Style-Type" content="text/css"> 6<link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default"> 7<title>FatFs - f_chdrive</title> 8</head> 9 10<body> 11 12<div class="para func"> 13<h2>f_chdrive</h2> 14<p>The f_chdrive function changes the current drive.</p> 15<pre> 16FRESULT f_chdrive ( 17 const TCHAR* <span class="arg">path</span> <span class="c">/* [IN] Logical drive number */</span> 18); 19</pre> 20</div> 21 22<div class="para arg"> 23<h4>Parameters</h4> 24<dl class="par"> 25<dt>path</dt> 26<dd>Specifies the <a href="filename.html">logical drive number</a> to be set as the current drive.</dd> 27</dl> 28</div> 29 30 31<div class="para ret"> 32<h4>Return Values</h4> 33<p> 34<a href="rc.html#ok">FR_OK</a>, 35<a href="rc.html#id">FR_INVALID_DRIVE</a> 36</p> 37</div> 38 39 40<div class="para desc"> 41<h4>Description</h4> 42<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> 43</div> 44 45<div class="para comp"> 46<h4>QuickInfo</h4> 47<p>Available when <tt><a href="config.html#fs_rpath">FF_FS_RPATH</a> >= 1</tt>.</p> 48</div> 49 50 51<div class="para use"> 52<h4>Example</h4> 53<pre> 54 <em>f_chdrive</em>("2:"); <span class="c">/* Set drive 2 as current drive */</span> 55 56 <em>f_chdrive</em>(""); <span class="c">/* No effect (set current drive as current drive) */</span> 57</pre> 58</div> 59 60 61<div class="para ref"> 62<h4>See Also</h4> 63<p><tt><a href="chdir.html">f_chdir</a>, <a href="getcwd.html">f_getcwd</a></tt></p> 64</div> 65 66 67<p class="foot"><a href="../00index_e.html">Return</a></p> 68</body> 69</html> 70