2014-08-13 05:48:16 +00:00
|
|
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
|
|
|
|
<html lang="ja">
|
|
|
|
|
<head>
|
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
|
|
|
|
|
<meta http-equiv="Content-Style-Type" content="text/css">
|
|
|
|
|
<link rel="up" title="FatFs" href="../00index_j.html">
|
|
|
|
|
<link rel="alternate" hreflang="en" title="English" href="../en/open.html">
|
|
|
|
|
<link rel="stylesheet" href="../css_j.css" type="text/css" media="screen" title="ELM Default">
|
|
|
|
|
<title>FatFs - f_open</title>
|
|
|
|
|
</head>
|
|
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
|
|
<div class="para func">
|
|
|
|
|
<h2>f_open</h2>
|
|
|
|
|
<p><EFBFBD>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD>[<5B>v<EFBFBD><76><EFBFBD>܂<EFBFBD><DC82>͍쐬<CD8D><EC90AC><EFBFBD>܂<EFBFBD><DC82>B</p>
|
|
|
|
|
<pre>
|
|
|
|
|
FRESULT f_open (
|
|
|
|
|
FIL* <span class="arg">fp</span>, <span class="c">/* [OUT] <20><><EFBFBD>̃t<CC83>@<40>C<EFBFBD><43><EFBFBD>E<EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>\<5C><><EFBFBD>̂ւ̃|<7C>C<EFBFBD><43><EFBFBD>^ */</span>
|
|
|
|
|
const TCHAR* <span class="arg">path</span>, <span class="c">/* [IN] <20>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD><EFBFBD><EFBFBD>ւ̃|<7C>C<EFBFBD><43><EFBFBD>^ */</span>
|
|
|
|
|
BYTE <span class="arg">mode</span> <span class="c">/* [IN] <20><><EFBFBD>[<5B>h<EFBFBD>t<EFBFBD><74><EFBFBD>O */</span>
|
|
|
|
|
);
|
|
|
|
|
</pre>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="para arg">
|
|
|
|
|
<h4><EFBFBD><EFBFBD><EFBFBD><EFBFBD></h4>
|
|
|
|
|
<dl class="par">
|
|
|
|
|
<dt>fp</dt>
|
|
|
|
|
<dd><EFBFBD>V<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쐬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD>E<EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>\<5C><><EFBFBD>̂ւ̃|<7C>C<EFBFBD><43><EFBFBD>^<5E><><EFBFBD>w<EFBFBD>肵<EFBFBD>܂<EFBFBD><DC82>B<EFBFBD>ȍ~<7E>A<EFBFBD><41><EFBFBD>̃t<CC83>@<40>C<EFBFBD><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD><C282><EFBFBD><EFBFBD>܂ł<DC82><C582>̃t<CC83>@<40>C<EFBFBD><43><EFBFBD>E<EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67><EFBFBD>g<EFBFBD>p<EFBFBD><70><EFBFBD>ăt<C483>@<40>C<EFBFBD><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B</dd>
|
|
|
|
|
<dt>path</dt>
|
|
|
|
|
<dd><EFBFBD>J<EFBFBD><EFBFBD><EFBFBD>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD><EFBFBD><a href="filename.html"><EFBFBD>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD><EFBFBD></a><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>k<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><tt>'\0'</tt><EFBFBD>I<EFBFBD>[<5B>̕<EFBFBD><CC95><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ւ̃|<7C>C<EFBFBD><43><EFBFBD>^<5E><><EFBFBD>w<EFBFBD>肵<EFBFBD>܂<EFBFBD><DC82>B</dd>
|
|
|
|
|
<dt>mode</dt>
|
|
|
|
|
<dd><EFBFBD>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD>̃A<CC83>N<EFBFBD>Z<EFBFBD>X<EFBFBD><58><EFBFBD>@<40><><EFBFBD>I<EFBFBD>[<5B>v<EFBFBD><76><EFBFBD><EFBFBD><EFBFBD>@<40><><EFBFBD><EFBFBD><EFBFBD>߂<EFBFBD><DF82>t<EFBFBD><74><EFBFBD>O<EFBFBD>ł<EFBFBD><C582>B<EFBFBD><42><EFBFBD>̃p<CC83><70><EFBFBD><EFBFBD><EFBFBD>[<5B>^<5E>ɂ͎<C982><CD8E>̑g<CC91>ݍ<EFBFBD><DD8D>킹<EFBFBD><ED82B9><EFBFBD>w<EFBFBD>肵<EFBFBD>܂<EFBFBD><DC82>B<br>
|
|
|
|
|
<table class="lst">
|
|
|
|
|
<tr><th><EFBFBD>l</th><th><EFBFBD>Ӗ<EFBFBD></th></tr>
|
|
|
|
|
<tr><td>FA_READ</td><td><EFBFBD>ǂݏo<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>[<5B>h<EFBFBD>ŊJ<C58A><4A><EFBFBD>܂<EFBFBD><DC82>B<EFBFBD>ǂݏ<C782><DD8F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ꍇ<EFBFBD><EA8D87><tt>FA_WRITE</tt><EFBFBD>Ƌ<EFBFBD><EFBFBD>Ɏw<EFBFBD>肵<EFBFBD>܂<EFBFBD><EFBFBD>B</td></tr>
|
|
|
|
|
<tr><td>FA_WRITE</td><td><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>݃<EFBFBD><EFBFBD>[<5B>h<EFBFBD>ŊJ<C58A><4A><EFBFBD>܂<EFBFBD><DC82>B<EFBFBD>ǂݏ<C782><DD8F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ꍇ<EFBFBD><EA8D87><tt>FA_READ</tt><EFBFBD>Ƌ<EFBFBD><EFBFBD>Ɏw<EFBFBD>肵<EFBFBD>܂<EFBFBD><EFBFBD>B</td></tr>
|
|
|
|
|
<tr><td>FA_OPEN_EXISTING</td><td><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̃t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD><EFBFBD><EFBFBD>J<EFBFBD><4A><EFBFBD>܂<EFBFBD><DC82>B<EFBFBD>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>̓G<CD83><47><EFBFBD>[<5B>ɂȂ<C982><C882>܂<EFBFBD><DC82>B(<28>f<EFBFBD>t<EFBFBD>H<EFBFBD><48><EFBFBD>g)</td></tr>
|
|
|
|
|
<tr><td>FA_OPEN_ALWAYS</td><td><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̃t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD><EFBFBD><EFBFBD>J<EFBFBD><4A><EFBFBD>܂<EFBFBD><DC82>B<EFBFBD>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>̓t<CD83>@<40>C<EFBFBD><43><EFBFBD><EFBFBD><EFBFBD>쐬<EFBFBD><EC90AC><EFBFBD>܂<EFBFBD><DC82>B<EFBFBD>NjL<C78B>̏ꍇ<CC8F>́A<CD81><41><EFBFBD>̕<EFBFBD><CC95>@<40>ŃI<C583>[<5B>v<EFBFBD><76><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A<a href="lseek.html"><tt>f_lseek()</tt></a><EFBFBD>Ńt<EFBFBD>@<40>C<EFBFBD><43><EFBFBD>̍Ō<CC8D><C58C><EFBFBD><EFBFBD>Ɉړ<C988><DA93><EFBFBD><EFBFBD>Ă<EFBFBD><C482><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>B</td></tr>
|
|
|
|
|
<tr><td>FA_CREATE_NEW</td><td><EFBFBD>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD><EFBFBD><EFBFBD>쐬<EFBFBD><EC90AC><EFBFBD>܂<EFBFBD><DC82>B<EFBFBD><42><EFBFBD><EFBFBD><EFBFBD>̃t<CC83>@<40>C<EFBFBD><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ꍇ<EFBFBD>́A<tt>FR_EXIST</tt><EFBFBD>Ŏ<EFBFBD><EFBFBD>s<EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><EFBFBD>B</td></tr>
|
|
|
|
|
<tr><td>FA_CREATE_ALWAYS</td><td><EFBFBD>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD><EFBFBD><EFBFBD>쐬<EFBFBD><EC90AC><EFBFBD>܂<EFBFBD><DC82>B<EFBFBD><42><EFBFBD><EFBFBD><EFBFBD>̃t<CC83>@<40>C<EFBFBD><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ꍇ<EFBFBD>́A<CD81>T<EFBFBD>C<EFBFBD>Y<EFBFBD><59>0<EFBFBD>ɂ<EFBFBD><C982>Ă<EFBFBD><C482><EFBFBD><EFBFBD>J<EFBFBD><4A><EFBFBD>܂<EFBFBD><DC82>B</td></tr>
|
|
|
|
|
</table>
|
|
|
|
|
</dd>
|
|
|
|
|
</dl>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="para ret">
|
|
|
|
|
<h4><EFBFBD>߂<EFBFBD><EFBFBD>l</h4>
|
|
|
|
|
<p>
|
|
|
|
|
<a href="rc.html#ok">FR_OK</a>,
|
|
|
|
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
|
|
|
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
|
|
|
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
|
|
|
|
<a href="rc.html#ok">FR_NO_FILE</a>,
|
|
|
|
|
<a href="rc.html#np">FR_NO_PATH</a>,
|
|
|
|
|
<a href="rc.html#in">FR_INVALID_NAME</a>,
|
|
|
|
|
<a href="rc.html#de">FR_DENIED</a>,
|
|
|
|
|
<a href="rc.html#ex">FR_EXIST</a>,
|
|
|
|
|
<a href="rc.html#io">FR_INVALID_OBJECT</a>,
|
|
|
|
|
<a href="rc.html#wp">FR_WRITE_PROTECTED</a>,
|
|
|
|
|
<a href="rc.html#id">FR_INVALID_DRIVE</a>,
|
|
|
|
|
<a href="rc.html#ne">FR_NOT_ENABLED</a>,
|
|
|
|
|
<a href="rc.html#ns">FR_NO_FILESYSTEM</a>,
|
|
|
|
|
<a href="rc.html#tm">FR_TIMEOUT</a>,
|
|
|
|
|
<a href="rc.html#lo">FR_LOCKED</a>,
|
|
|
|
|
<a href="rc.html#nc">FR_NOT_ENOUGH_CORE</a>,
|
|
|
|
|
<a href="rc.html#tf">FR_TOO_MANY_OPEN_FILES</a>
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="para desc">
|
|
|
|
|
<h4><EFBFBD><EFBFBD><EFBFBD><EFBFBD></h4>
|
|
|
|
|
<p><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̃t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD><EFBFBD><EFBFBD>J<EFBFBD><4A><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD><EFBFBD><EFBFBD>쐬<EFBFBD><EC90AC><EFBFBD>܂<EFBFBD><DC82>B<EFBFBD><EFBFBD><D690><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƃt<C683>@<40>C<EFBFBD><43><EFBFBD>E<EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67><EFBFBD>쐬<EFBFBD><EC90AC><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD>ȍ~<7E><><EFBFBD>̃t<CC83>@<40>C<EFBFBD><43><EFBFBD>ɑ<C991><CE82><EFBFBD><EFBFBD>A<EFBFBD>N<EFBFBD>Z<EFBFBD>X<EFBFBD>Ɏg<C98E>p<EFBFBD><70><EFBFBD>܂<EFBFBD><DC82>B<EFBFBD>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD><C282><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>́A<a href="close.html"><tt>f_close()</tt></a><EFBFBD><EFBFBD><EFBFBD>g<EFBFBD>p<EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><EFBFBD>B<EFBFBD><EFBFBD><EFBFBD>炩<EFBFBD>̕ύX<EFBFBD><EFBFBD><EFBFBD>s<EFBFBD><EFBFBD><EFBFBD>ꂽ<EFBFBD>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̌㐳<CC8C><E390B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><C282><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȃ<EFBFBD><C882><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ꍇ<EFBFBD>A<EFBFBD><41><EFBFBD>̃t<CC83>@<40>C<EFBFBD><43><EFBFBD><EFBFBD><EFBFBD>j<EFBFBD><6A><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ꍇ<EFBFBD><EA8D87><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B</p>
|
|
|
|
|
<p><EFBFBD><EFBFBD><EFBFBD>ɊJ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ă<EFBFBD><EFBFBD><EFBFBD><EFBFBD>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD><EFBFBD><EFBFBD>J<EFBFBD><4A><EFBFBD>K<EFBFBD>v<EFBFBD><76><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ꍇ<EFBFBD>́A<a href="appnote.html#dup"><EFBFBD><EFBFBD><EFBFBD>d<EFBFBD>A<EFBFBD>N<EFBFBD>Z<EFBFBD>X<EFBFBD><EFBFBD><EFBFBD><EFBFBD></a><EFBFBD><EFBFBD><EFBFBD>Q<EFBFBD>Ƃ<EFBFBD><EFBFBD>Ă<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>B<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD><EFBFBD><EFBFBD>̃t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD>ɑ<C991><CE82>鏑<EFBFBD><E98F91><EFBFBD><EFBFBD><EFBFBD>݃<EFBFBD><DD83>[<5B>h<EFBFBD><68><EFBFBD>܂ޏd<DE8F><64><EFBFBD>I<EFBFBD>[<5B>v<EFBFBD><76><EFBFBD>͏<EFBFBD><CD8F>ɋ֎~<7E>ł<EFBFBD><C582>B</p>
|
|
|
|
|
<p><EFBFBD>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD>E<EFBFBD>A<EFBFBD>N<EFBFBD>Z<EFBFBD>X<EFBFBD><58><EFBFBD>J<EFBFBD>n<EFBFBD><6E><EFBFBD><EFBFBD><EFBFBD>O<EFBFBD>ɁA<a href="mount.html"><tt>f_mount()</tt></a><EFBFBD><EFBFBD><EFBFBD>g<EFBFBD><EFBFBD><EFBFBD>Ă<EFBFBD><EFBFBD>ꂼ<EFBFBD><EFBFBD><EFBFBD>̘_<EFBFBD><EFBFBD><EFBFBD>h<EFBFBD><EFBFBD><EFBFBD>C<EFBFBD>u<EFBFBD>Ƀ<EFBFBD><EFBFBD>[<5B>N<EFBFBD>E<EFBFBD>G<EFBFBD><47><EFBFBD>A(<28>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD>E<EFBFBD>V<EFBFBD>X<EFBFBD>e<EFBFBD><65><EFBFBD>E<EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g)<29><><EFBFBD>^<5E><><EFBFBD><EFBFBD><EFBFBD>K<EFBFBD>v<EFBFBD><76><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B<EFBFBD><42><EFBFBD>̏<EFBFBD><CC8F><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̌<EFBFBD><CC8C>A<EFBFBD><41><EFBFBD>̘_<CC98><5F><EFBFBD>h<EFBFBD><68><EFBFBD>C<EFBFBD>u<EFBFBD>ɑ<C991><CE82>đS<C491>Ẵt<CC83>@<40>C<EFBFBD><43><EFBFBD><EFBFBD><D690><EFBFBD><EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD>悤<EFBFBD>ɂȂ<C982><C882>܂<EFBFBD><DC82>B</p>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="para comp">
|
|
|
|
|
<h4><EFBFBD>Ή<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></h4>
|
|
|
|
|
<p><EFBFBD>S<EFBFBD>Ă̍\<5C><><EFBFBD>Ŏg<C58E>p<EFBFBD>\<5C>ł<EFBFBD><C582>B<tt>_FS_READONLY == 1</tt><EFBFBD>̂Ƃ<EFBFBD><EFBFBD>́A<tt>FA_WRITE, FA_CREATE_ALWAYS, FA_CREATE_NEW, FA_OPEN_ALWAYS</tt><EFBFBD>̊e<EFBFBD>t<EFBFBD><EFBFBD><EFBFBD>O<EFBFBD>̓T<EFBFBD>|<7C>[<5B>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B</p>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="para use">
|
|
|
|
|
<h4><EFBFBD>g<EFBFBD>p<EFBFBD><EFBFBD></h4>
|
|
|
|
|
<pre>
|
|
|
|
|
<span class="c">/* <20>e<EFBFBD>L<EFBFBD>X<EFBFBD>g<EFBFBD>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD><EFBFBD><EFBFBD>ǂݏo<DD8F><6F><EFBFBD>ĕ\<5C><> */</span>
|
|
|
|
|
|
|
|
|
|
FATFS FatFs; <span class="c">/* <20>_<EFBFBD><5F><EFBFBD>h<EFBFBD><68><EFBFBD>C<EFBFBD>u<EFBFBD>̃<EFBFBD><CC83>[<5B>N<EFBFBD>E<EFBFBD>G<EFBFBD><47><EFBFBD>A(<28>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD>E<EFBFBD>V<EFBFBD>X<EFBFBD>e<EFBFBD><65><EFBFBD>E<EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g) */</span>
|
|
|
|
|
|
|
|
|
|
int main (void)
|
|
|
|
|
{
|
|
|
|
|
FIL fil; <span class="c">/* <20>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD>E<EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g */</span>
|
|
|
|
|
char line[82]; <span class="c">/* <20>s<EFBFBD>o<EFBFBD>b<EFBFBD>t<EFBFBD>@ */</span>
|
|
|
|
|
FRESULT fr; <span class="c">/* <20>߂<EFBFBD><DF82>l */</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="c">/* <20>f<EFBFBD>t<EFBFBD>H<EFBFBD><48><EFBFBD>g<EFBFBD>E<EFBFBD>h<EFBFBD><68><EFBFBD>C<EFBFBD>u<EFBFBD>Ƀ<EFBFBD><C983>[<5B>N<EFBFBD>G<EFBFBD><47><EFBFBD>A<EFBFBD><41><EFBFBD>^<5E><><EFBFBD><EFBFBD> */</span>
|
|
|
|
|
f_mount(&FatFs, "", 0);
|
|
|
|
|
|
|
|
|
|
<span class="c">/* <20>e<EFBFBD>L<EFBFBD>X<EFBFBD>g<EFBFBD>E<EFBFBD>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD><EFBFBD><EFBFBD>J<EFBFBD><4A> */</span>
|
|
|
|
|
fr = f_open(&fil, "message.txt", FA_READ);
|
|
|
|
|
if (fr) return (int)fr;
|
|
|
|
|
|
|
|
|
|
<span class="c">/* 1<>s<EFBFBD><73><EFBFBD>ǂݏo<DD8F><6F><EFBFBD>ĕ\<5C><> */</span>
|
|
|
|
|
while (f_gets(line, sizeof line, &fil))
|
|
|
|
|
printf(line);
|
|
|
|
|
|
|
|
|
|
<span class="c">/* <20>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD><C282><EFBFBD> */</span>
|
|
|
|
|
f_close(&fil);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
</pre>
|
|
|
|
|
<pre>
|
|
|
|
|
<span class="c">/* <20>h<EFBFBD><68><EFBFBD>C<EFBFBD>u1<75>̃t<CC83>@<40>C<EFBFBD><43> "file.bin" <20><><EFBFBD>h<EFBFBD><68><EFBFBD>C<EFBFBD>u0<75>փR<D683>s<EFBFBD>[ */</span>
|
|
|
|
|
|
|
|
|
|
int main (void)
|
|
|
|
|
{
|
|
|
|
|
FATFS fs[2]; <span class="c">/* <20>_<EFBFBD><5F><EFBFBD>h<EFBFBD><68><EFBFBD>C<EFBFBD>u<EFBFBD>̃<EFBFBD><CC83>[<5B>N<EFBFBD>G<EFBFBD><47><EFBFBD>A(<28>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD>E<EFBFBD>V<EFBFBD>X<EFBFBD>e<EFBFBD><65><EFBFBD>E<EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g) */</span>
|
|
|
|
|
FIL fsrc, fdst; <span class="c">/* <20>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD>E<EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g */</span>
|
|
|
|
|
BYTE buffer[4096]; <span class="c">/* File copy buffer */</span>
|
|
|
|
|
FRESULT fr; <span class="c">/* FatFs function common result code */</span>
|
|
|
|
|
UINT br, bw; <span class="c">/* File R/W count */</span>
|
|
|
|
|
|
|
|
|
|
<span class="c">/* <20>h<EFBFBD><68><EFBFBD>C<EFBFBD>u0,1<>Ƀ<EFBFBD><C983>[<5B>N<EFBFBD>E<EFBFBD>G<EFBFBD><47><EFBFBD>A<EFBFBD><41><EFBFBD>^<5E><><EFBFBD><EFBFBD> */</span>
|
|
|
|
|
f_mount(&fs[0], "0:", 0);
|
|
|
|
|
f_mount(&fs[1], "1:", 0);
|
|
|
|
|
|
|
|
|
|
<span class="c">/* <20>h<EFBFBD><68><EFBFBD>C<EFBFBD>u1<75>̃R<CC83>s<EFBFBD>[<5B><><EFBFBD>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD><EFBFBD><EFBFBD>J<EFBFBD><4A> */</span>
|
|
|
|
|
res = f_open(&fsrc, "1:file.dat", FA_OPEN_EXISTING | FA_READ);
|
|
|
|
|
if (fr) return (int)fr;
|
|
|
|
|
|
|
|
|
|
<span class="c">/* <20>h<EFBFBD><68><EFBFBD>C<EFBFBD>u0<75>ɃR<C983>s<EFBFBD>[<5B><><EFBFBD>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD><EFBFBD><EFBFBD>쐬<EFBFBD><EC90AC><EFBFBD><EFBFBD> */</span>
|
|
|
|
|
res = f_open(&fdst, "0:file.dat", FA_CREATE_ALWAYS | FA_WRITE);
|
|
|
|
|
if (fr) return (int)fr;
|
|
|
|
|
|
|
|
|
|
<span class="c">/* <20>R<EFBFBD>s<EFBFBD>[<5B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>R<EFBFBD>s<EFBFBD>[<5B><><EFBFBD>Ƀf<C983>[<5B>^<5E>]<5D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */</span>
|
|
|
|
|
for (;;) {
|
|
|
|
|
res = f_read(&fsrc, buffer, sizeof buffer, &br); <span class="c">/* <20>R<EFBFBD>s<EFBFBD>[<5B><><EFBFBD><EFBFBD><EFBFBD>炩<EFBFBD><E782A9><EFBFBD>ǂݏo<DD8F><6F> */</span>
|
|
|
|
|
if (res || br == 0) break; <span class="c">/* <20>G<EFBFBD><47><EFBFBD>[<5B><><EFBFBD>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD>I<EFBFBD>[ */</span>
|
|
|
|
|
res = f_write(&fdst, buffer, br, &bw); <span class="c">/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>R<EFBFBD>s<EFBFBD>[<5B><><EFBFBD>ɏ<EFBFBD><C98F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */</span>
|
|
|
|
|
if (res || bw < br) break; <span class="c">/* <20>G<EFBFBD><47><EFBFBD>[<5B><><EFBFBD>f<EFBFBD>B<EFBFBD>X<EFBFBD>N<EFBFBD><4E><EFBFBD>t */</span>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
<span class="c">/* <20>S<EFBFBD>Ẵt<CC83>@<40>C<EFBFBD><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD><C282><EFBFBD> */</span>
|
|
|
|
|
f_close(&fsrc);
|
|
|
|
|
f_close(&fdst);
|
|
|
|
|
|
|
|
|
|
<span class="c">/* <20><><EFBFBD>[<5B>N<EFBFBD>E<EFBFBD>G<EFBFBD><47><EFBFBD>A<EFBFBD><41><EFBFBD>J<EFBFBD><4A><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */</span>
|
|
|
|
|
f_mount(NULL, "0:", 0);
|
|
|
|
|
f_mount(NULL, "1:", 0);
|
|
|
|
|
|
|
|
|
|
return (int)fr;
|
|
|
|
|
}
|
|
|
|
|
</pre>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="para ref">
|
|
|
|
|
<h4><EFBFBD>Q<EFBFBD><EFBFBD></h4>
|
|
|
|
|
<p><tt><a href="read.html">f_read</a>, <a href="write.html">f_write</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a>, <a href="sfatfs.html">FATFS</a></tt></p>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<p class="foot"><a href="../00index_j.html"><EFBFBD>߂<EFBFBD></a></p>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|