<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">SPIFFS는 SPI 연결을 이용하는 FLASH 저장 장치의 파일 시스템을 정의하고 데이터가 저장된 파일의 생성 및 수정 그리고 읽기를 하는 프로그램이다.&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">SPIFFS는 EEPROM과 다르게 인덱스를 기준으로 저장하지 않고 파일 단위로 데이터를 구분하여 저장할 수 있다. 파일 단위로 저장할 수 있게되면서 스트링 형식의 데이터를 처리하는데 용이하고, 그 스트링은 JSON 형식 또는 배열 형식이 될 수 있다. 이 얘기는 JSON 형식일 경우 파일 내에 변수 인자가 포함 된다는 것이고, 배열 형식일 경우 EEPROM처럼 인덱스를 이용하여 데이터의 처리가 가능하다는 것이다. 이는 독립된 EEPROM 여러개를 사용하는 것과 비슷하다. 따라서 EPROM을 대체할 수 있으며, 데이터 초기값을 포함한 파일(예: config.txt)을 컴파일 전에 미리 올려 놓을 수 있어서 EEPROM처럼 MCU 셋업시 초기값을 써주어야 하는 과정을 생략할 수 있는 장점이 있다.&nbsp;&nbsp;단점은 EEPROM과 마찬 가지로 데이터 쓰기시 상당한 시간이 소요된다. 상당한 시간이라고 했지만 보통은 불편함 없이 사용할 수 있다. 다만, 타이머에 의한 인터럽트가 빠른 주기로 실행되고 있을 때에는(예: LED 디스플레이 출력용 데이터 전송 등) 타이머 인터럽트가 실행되는 시간 간격보다 더 많은 시간이 소요되어 타이머 인터럽트의 실행을 방해하고 오류를 발생 시킬 수 있다.</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">이미 파일 형태로 저장된 데이터를 스케치 컴파일전에 SPIFFS파일 시스템에 업로드 시키기 위해서는 아두이노 IDE에 플러그인 형태로 설치되는 프로그램을 사용하여야 한다. 플러그인 설치에 관해서는 이글의 말미에 언급하겠다.</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">목표: SPIFFS를 이용하여 다음과 같은 작업을 시행해 보자.</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">1. SPIFFS 파일 시스템 포맷하기</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">2. 스트링 데이터 저장, 읽기, 수정하기</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">3.&nbsp;Stream&nbsp;함수 테스트</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">4. 와이파이 환경설정 정보를 저장하고 읽기</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">5. 폰트파일을 모듈에 업로드 하고 그 폰트파일을 이용하여 시리얼 모니터에 문자 이미지를 출력하기</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">아래는 ESP8266의 시스템 구조이다.</p>
<figure class="imageblock alignLeft" data-filename="spiff_file_system.png" data-origin-width="697" data-origin-height="112" style="margin: 0px 0px 20px; max-width: 100%; clear: both; display: table; position: relative; font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;"><span data-url="https://blog.kakaocdn.net/dn/zhSGj/btqCQoEvTL3/0A5vWKXOj2kSZRokx9O3YK/img.png" data-lightbox="lightbox" data-alt="" style="box-sizing: border-box; cursor: pointer;"><img src="https://blog.kakaocdn.net/dn/zhSGj/btqCQoEvTL3/0A5vWKXOj2kSZRokx9O3YK/img.png" srcset="https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FzhSGj%2FbtqCQoEvTL3%2F0A5vWKXOj2kSZRokx9O3YK%2Fimg.png" data-filename="spiff_file_system.png" data-origin-width="697" data-origin-height="112" style="border: 0px; max-width: 100%; display: inline-block; width: 697px; margin: 0px; height: auto;" /></span></figure>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">ESP8266의 파일 시스템은 저장 장치 FLASH(NodeMcu의 경우 4M)를 각 사용 영역별로 분할 하게 되는데 상기 그림에서 볼 수 있듯이 Sketch, OTA update, File system, EEPROM, WiFi config(SDK)로 나뉘며 WiFi config를 제외한 나머지 항목들을 아두이노 IDE의&nbsp;툴 -&gt; Flash Size 항목(ESP32의 경우 Partition Scheme)에서 그 크기들에 대한 설정을 할 수 있다.&nbsp;&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">Sketch 영역은 스케치가 업로드되는 영역이고 OTA update는 무선으로 스케치를 변경하기 위해 할당된 영역이며 File system이 다루고자 하는 SPIFFS 라이브러리에 의해 생성된 파일들이 저장되는 영역이다. WiFi config 영역은 WiFi 환경에 관한 내용들 SSID, Password등 WiFi 연결에 관한 설정을 저장하는 항목인데 보안상 이유 때문에 일반적으로 직접 접근하여 수정할수 없고 Wifi 라이브러리에 의해 관리되는 영역이다. 이러한 이유로 와이파이 관련 데이터가 변경될 경우 이전 데이터가 남아 있어 WiFi 연결이 지연되거나 오류(Stack Error)를 유발하는 경우가 있었다. SSID와 Password를 변경한 스케치를 반복적으로 업로드 하던중 간혹 발생했었다. 이런 오류가 발생하면 ESP8266의 전체 시스템을 공장 초기화 하고 스케치를 다시 업로드 하는게 쉬운 해결 방법이다.&nbsp; 공장 초기화 방법은 이전글&nbsp;<b><a href="https://postpop.tistory.com/26" style="color: #000000; text-decoration-line: none; transition: all 0.3s ease 0s;" target="_blank">Esp8266 NodeMcu 및 ESP32 Dev Module, stack 오류</a></b>&nbsp;을 참조하기 바란다.</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">&nbsp;</p>
<div style="box-sizing: border-box; font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1; position: relative; text-align: center; overflow: hidden; margin: auto;"><ins class="kakao_ad_area" data-ad-unit="DAN-1iaxmu4263dk5" data-ad-width="728" data-ad-height="90" id="kakao_ad_R9r2l1_9146" data-ad-rfseq="1" data-ad-status="done" data-ad-viewable="standby" data-ad-rendered="Y" data-ad-request-id="dd8d5021-4883-4bda-b863-149531461d5e" data-ad-rfinterval="30" data-ad-bordercolor="unknown" data-ad-action="" data-ad-actioninterval="0" data-ad-refreshlimit="0" data-ad-noadmaxcount="10" data-ad-noadseq="0" style="display: inline-block; text-decoration-line: none; min-width: 728px; min-height: 90px; width: 728px; height: 90px;">
      <div data-ad-creative-wrap="outer" style="box-sizing: border-box; overflow: hidden; position: relative; min-width: 728px; min-height: 90px; max-height: inherit;">
         <div data-ad-creative-wrap="inner" style="box-sizing: border-box; overflow: hidden; height: 90px;"><iframe frameborder="0" scrolling="no" marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true" id="adfit_frame_id_CMB9OK_8329" name="adfit_frame_id_CMB9OK_8329" style="max-width: 100%; min-width: 728px; width: 728px; min-height: 90px; height: 90px; display: block; border-width: 0px; border-style: initial; margin: 0px auto;"></iframe></div>
         </div>
      </ins></div>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">아두이노 IDE에서 SPIFFS 파일시스템 설정 하기</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">SPIFFS 파일시스템을 사용하기 위해서는 아두이노 IDE의 툴 -&gt; 모듈 항목에서 SPIFFS 파일시스템에서 사용할 용량을 설정해주어야 한다.</p>
<figure class="imageblock alignCenter" data-filename="esp8266_spiff_filesystem.png" data-origin-width="896" data-origin-height="616" style="margin: 0px auto 20px; max-width: 100%; clear: both; display: table; position: relative; text-align: center; font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;"><span data-url="https://blog.kakaocdn.net/dn/T3Ehk/btqCRzyOfOy/ku9UCM5NcdQTQC0B1hv6Wk/img.png" data-lightbox="lightbox" data-alt="ESP8266 NodeMcu 파일시스템 설정(SPIFFS 사용)" style="box-sizing: border-box; cursor: pointer;"><img src="https://blog.kakaocdn.net/dn/T3Ehk/btqCRzyOfOy/ku9UCM5NcdQTQC0B1hv6Wk/img.png" srcset="https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FT3Ehk%2FbtqCRzyOfOy%2Fku9UCM5NcdQTQC0B1hv6Wk%2Fimg.png" data-filename="esp8266_spiff_filesystem.png" data-origin-width="896" data-origin-height="616" style="border: 0px; max-width: 100%; display: inline-block; width: 896px; margin: 0px; height: auto;" /></span>
   <figcaption style="font-size: 13px; word-break: break-word; padding-top: 10px; min-height: 20px; caption-side: bottom;">ESP8266 NodeMcu 파일시스템 설정(SPIFFS 사용)</figcaption>
   </figure>
<figure class="imageblock alignCenter" data-filename="spiff_size.png" data-origin-width="1008" data-origin-height="662" style="margin: 0px auto 20px; max-width: 100%; clear: both; display: table; position: relative; text-align: center; font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;"><span data-url="https://blog.kakaocdn.net/dn/c7ZjJR/btqCUx7Azhx/bFZt7YuSWMsQMaBImYvsAK/img.png" data-lightbox="lightbox" data-alt="ESP32 파일시스템 설정(SPIFFS 사용)" style="box-sizing: border-box; cursor: pointer;"><img src="https://blog.kakaocdn.net/dn/c7ZjJR/btqCUx7Azhx/bFZt7YuSWMsQMaBImYvsAK/img.png" srcset="https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fc7ZjJR%2FbtqCUx7Azhx%2FbFZt7YuSWMsQMaBImYvsAK%2Fimg.png" data-filename="spiff_size.png" data-origin-width="1008" data-origin-height="662" style="border: 0px; max-width: 100%; display: inline-block; width: 1008px; margin: 0px; height: auto;" /></span>
   <figcaption style="font-size: 13px; word-break: break-word; padding-top: 10px; min-height: 20px; caption-side: bottom;">ESP32 파일시스템 설정(SPIFFS 사용)</figcaption>
   </figure>
<h3 style="font-size: 1.44em; font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; background-color: #f1f1f1;">1. SPIFFS 파일 시스템 포맷하기</h3>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">SPIFFS 파일시스템내 파일을 모두 삭제하고자 할 때 사용하면된다.&nbsp; 스케치를 업로드 했는데 SPIFFS 파일시스템을 마운트하는데 실패하는 경우가 발생할 수 있다. 그럴때는 상기의 파티션 설정에서 SPIFF 파일 시스템을 사용하도록 설정했는지 확인해보거나 SPIFFS 파일 시스템을 포맷해 보기 바란다.</p>
<figure class="fileblock" style="margin: 28px auto 20px; max-width: 100%; clear: both; width: 470px; height: 71px; border: 1px solid rgb(233, 233, 233); position: relative; border-radius: 1px; font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;"><a href="https://blog.kakaocdn.net/dn/dOz499/btqCQ284kmr/bdBFd1GxNw6kWyGbWEeomk/SPIFFS_format.ino?attach=1&amp;knm=tfile.ino" style="color: #000000; text-decoration-line: none; transition: all 0.3s ease 0s; display: block; height: 71px;" target="_blank">
      <div class="image" style="box-sizing: border-box; position: absolute; left: 0px; top: 0px; width: 30px; height: 30px; background-image: url(&quot;https://t1.daumcdn.net/tistory_admin/static/manage/post-editor/img_editor_content.svg&quot;); background-position: 0px 0px; margin: 21px 17px 20px 22px;">&nbsp;</div>
      <div class="desc" style="box-sizing: border-box; position: absolute; left: 70px; right: 60px; top: 0px; bottom: 0px;">
         <div class="filename" style="box-sizing: border-box; color: #333333; font-size: 14px; text-overflow: ellipsis; height: 20px; margin: 17px 0px 0px;"><span class="name" style="box-sizing: border-box; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 272px; height: 20px; display: block;">SPIFFS_format.ino</span></div>
         <div class="size" style="box-sizing: border-box; font-family: &quot;Avenir Next&quot;, sans-serif; font-size: 12px; color: #777777; height: 16px; margin: 2px 0px 0px;">0.00MB</div>
         </div>
      </a></figure>
<pre id="code_1584879314362" class="c++ arduino" data-ke-language="c++" data-ke-type="codeblock" style="overflow: auto; padding: 15px; margin: 20px auto 0px; max-width: 100%; border: 1px solid rgb(221, 221, 221); font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 14px; line-height: 25.2px; font-family: Menlo, Consolas, Monaco, monospace; background: rgb(246, 247, 248); border-radius: 3px; color: #383a42; cursor: default; z-index: 1;">
   <code class="hljs cpp" style="border: 1px solid rgb(238, 238, 238); background: rgb(40, 44, 52); color: #abb2bf; border-radius: 5px; padding: 0.5em; margin: 3px 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 17px; line-height: 1.3em; font-family: D2Coding, monospace; display: block; overflow-x: auto;"><span class="hljs-meta" style="box-sizing: border-box; color: #61aeee;">#<span class="hljs-meta-keyword" style="box-sizing: border-box;">include</span><span class="hljs-meta-string" style="box-sizing: border-box; color: #98c379;">"FS.h"</span><span class="hljs-comment" style="box-sizing: border-box; color: #b18eb1; font-style: italic;">// ESP8266 SPIFFS 라이브러리</span></span><span class="hljs-comment" style="box-sizing: border-box; color: #b18eb1; font-style: italic;">//#include "SPIFFS.h"  // ESP32 SPIFFS 라이브러리</span><span class="hljs-function" style="box-sizing: border-box; color: #61aeee;"><span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">void</span><span class="hljs-title" style="box-sizing: border-box;">setup</span><span class="hljs-params" style="box-sizing: border-box; color: #a6e22e;">()</span></span>{
  Serial.begin(<span class="hljs-number" style="box-sizing: border-box; color: #d19a66;">115200</span>);
  Serial.println();
  SPIFFS.begin();
  SPIFFS.format();
  Serial.println(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"Format complete!"</span>);
}
<span class="hljs-function" style="box-sizing: border-box; color: #61aeee;"><span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">void</span><span class="hljs-title" style="box-sizing: border-box;">loop</span><span class="hljs-params" style="box-sizing: border-box; color: #a6e22e;">()</span></span>{
}</code>
   </pre>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">&nbsp;</p>
<div style="box-sizing: border-box; font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1; width: 6623.34px; height: 90px; margin: auto; text-align: center;"><ins class="adsbygoogle" data-ad-client="ca-pub-8269928309278636" data-ad-slot="3647290720" data-adsbygoogle-status="done" style="display: inline-block; width: 728px; height: 90px;"><ins id="aswift_2_expand" style="display: inline-table; border: none; height: 90px; margin: 0px; padding: 0px; position: relative; visibility: visible; width: 728px; background-color: transparent;"><ins id="aswift_2_anchor" style="display: block; border: none; height: 90px; margin: 0px; padding: 0px; position: relative; visibility: visible; width: 728px; background-color: transparent;"><iframe id="aswift_2" name="aswift_2" sandbox="allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-top-navigation-by-user-activation" width="728" height="90" frameborder="0" src="https://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-8269928309278636&amp;output=html&amp;h=90&amp;slotname=3647290720&amp;adk=2731592040&amp;adf=4195724218&amp;w=728&amp;lmt=1597037830&amp;psa=1&amp;guci=2.2.0.0.2.2.0.0&amp;format=728x90&amp;url=https%3A%2F%2Fpostpop.tistory.com%2F97%3Fcategory%3D744994&amp;flash=0&amp;wgl=1&amp;dt=1597037829903&amp;bpp=1&amp;bdt=353&amp;idt=203&amp;shv=r20200805&amp;cbv=r20190131&amp;ptt=9&amp;saldr=aa&amp;abxe=1&amp;cookie=ID%3D720ca2025ee5b318%3AT%3D1597021416%3AS%3DALNI_MbwB0RmCu8y8M7-tE67Lg-ncQLpkQ&amp;prev_fmts=0x0%2C300x250&amp;nras=1&amp;correlator=8762422388933&amp;frm=20&amp;pv=1&amp;ga_vid=190590715.1597021417&amp;ga_sid=1597037830&amp;ga_hid=661654081&amp;ga_fc=0&amp;iag=0&amp;icsg=2814921700674082&amp;dssz=51&amp;mdo=0&amp;mso=0&amp;u_tz=540&amp;u_his=22&amp;u_java=0&amp;u_h=1440&amp;u_w=2560&amp;u_ah=1400&amp;u_aw=2560&amp;u_cd=24&amp;u_nplug=3&amp;u_nmime=4&amp;adx=412&amp;ady=3323&amp;biw=1261&amp;bih=1287&amp;scr_x=0&amp;scr_y=0&amp;eid=42530558%2C42530560%2C21066393&amp;oid=3&amp;pvsid=2275327659788414&amp;pem=173&amp;ref=https%3A%2F%2Fpostpop.tistory.com%2F95%3Fcategory%3D744994&amp;rx=0&amp;eae=0&amp;fc=1920&amp;brdim=-7%2C40%2C-7%2C40%2C2560%2C40%2C1294%2C1407%2C1278%2C1287&amp;vis=1&amp;rsz=%7C%7CeEbr%7C&amp;abl=CS&amp;pfx=0&amp;fu=8192&amp;bc=31&amp;ifi=2&amp;uci=a!2&amp;btvi=1&amp;fsb=1&amp;xpc=6A5vNSfm3L&amp;p=https%3A//postpop.tistory.com&amp;dtd=209" marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true" scrolling="no" allowfullscreen="true" data-google-container-id="a!2" data-google-query-id="CIHT_cP1j-sCFaTDTAIdP0oJzA" data-load-complete="true" style="max-width: 100%; left: 0px; position: absolute; top: 0px; border-width: 0px; border-style: initial; width: 728px; height: 90px;"></iframe></ins></ins></ins></div>
<p data-ke-size="size14" style="font-size: 0.87em; font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; background-color: #f1f1f1;">&nbsp;</p>
<h3 style="font-size: 1.44em; font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; background-color: #f1f1f1;">2. 스트링 데이터 저장, 읽기, 수정하기</h3>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">SPIFF 라이브러리 역시 ESP8266과 ESP32 라이브러리 코드가 비슷하다. ESP8266 SPIFF 코드를을 기반으로 ESP32용 코드가 만들어 졌으리라 생각한다. 따라서 우선 ESP8266 SPIFF 코드들을 살펴보고 ESP32 코드의 다른점들을 비교해 보겠다.&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">우선, 예제로서 ESP32의 SPIFFS 예제를 가져와 ESP8266에서 사용할 수 있도록 코드를 수정해 주었다. ESP32의 SPIFFS 예제는 파일 생성 / 삭제, 스트링 쓰기, 추가하기와 쓰기 읽기 성능 테스트(벤치 마크)를 하도록 코딩되어 있다. 성능 테스트 기능이 있으므로 ESP8266의 CPU Frequency를 변경해가며 테스트도 해보자.</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">SPIFFS 라이브러리 명칭</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">#include "FS.h"&nbsp; &nbsp; &nbsp; &nbsp; // ESP8266<br />#include "SPIFFS.h"&nbsp; &nbsp;// ESP32</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">아래 스케치는 ESP32용 SPIFFS 테스트 코드를 ESP8266에 맞게 수정해 준 것이다.</p>
<figure class="fileblock" style="margin: 28px auto 20px; max-width: 100%; clear: both; width: 470px; height: 71px; border: 1px solid rgb(233, 233, 233); position: relative; border-radius: 1px; font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;"><a href="https://blog.kakaocdn.net/dn/bqHXzE/btqCPBqvub2/qKhNM0e9B0gUpa312UgNcK/ESP8266_example_SPIFFS_Test.ino?attach=1&amp;knm=tfile.ino" style="color: #000000; text-decoration-line: none; transition: all 0.3s ease 0s; display: block; height: 71px;" target="_blank">
      <div class="image" style="box-sizing: border-box; position: absolute; left: 0px; top: 0px; width: 30px; height: 30px; background-image: url(&quot;https://t1.daumcdn.net/tistory_admin/static/manage/post-editor/img_editor_content.svg&quot;); background-position: 0px 0px; margin: 21px 17px 20px 22px;">&nbsp;</div>
      <div class="desc" style="box-sizing: border-box; position: absolute; left: 70px; right: 60px; top: 0px; bottom: 0px;">
         <div class="filename" style="box-sizing: border-box; color: #333333; font-size: 14px; text-overflow: ellipsis; height: 20px; margin: 17px 0px 0px;"><span class="name" style="box-sizing: border-box; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 272px; height: 20px; display: block;">ESP8266_example_SPIFFS_Test.ino</span></div>
         <div class="size" style="box-sizing: border-box; font-family: &quot;Avenir Next&quot;, sans-serif; font-size: 12px; color: #777777; height: 16px; margin: 2px 0px 0px;">0.00MB</div>
         </div>
      </a></figure>
<pre id="code_1584879314363" class="c++ arduino" data-ke-language="c++" data-ke-type="codeblock" style="overflow: auto; padding: 15px; margin: 20px auto 0px; max-width: 100%; border: 1px solid rgb(221, 221, 221); font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 14px; line-height: 25.2px; font-family: Menlo, Consolas, Monaco, monospace; background: rgb(246, 247, 248); border-radius: 3px; color: #383a42; cursor: default; z-index: 1;">
   <code class="hljs cpp" style="border: 1px solid rgb(238, 238, 238); background: rgb(40, 44, 52); color: #abb2bf; border-radius: 5px; padding: 0.5em; margin: 3px 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 17px; line-height: 1.3em; font-family: D2Coding, monospace; display: block; overflow-x: auto;"><span class="hljs-meta" style="box-sizing: border-box; color: #61aeee;">#<span class="hljs-meta-keyword" style="box-sizing: border-box;">include</span><span class="hljs-meta-string" style="box-sizing: border-box; color: #98c379;">"FS.h"</span></span><span class="hljs-function" style="box-sizing: border-box; color: #61aeee;"><span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">void</span><span class="hljs-title" style="box-sizing: border-box;">setup</span><span class="hljs-params" style="box-sizing: border-box; color: #a6e22e;">()</span></span>{
  Serial.begin(<span class="hljs-number" style="box-sizing: border-box; color: #d19a66;">115200</span>);
  Serial.println();
  <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">if</span> (!SPIFFS.begin()) {
    Serial.println(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"Failed to mount file system"</span>);
    <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">return</span>;
  }
  SPIFFS.format();
  FSInfo fsInfo;
  SPIFFS.info(fsInfo);
  Serial.print(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"totalBytes: "</span>); Serial.println(fsInfo.totalBytes);
  Serial.print(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"usedBytes: "</span>); Serial.println(fsInfo.usedBytes);
  listDir(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"/"</span>);
  writeFile(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"/hello.txt"</span>, <span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"Hello "</span>);
  readFile(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"/hello.txt"</span>);
  appendFile(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"/hello.txt"</span>, <span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"World!\r\n"</span>);
  readFile(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"/hello.txt"</span>);
  renameFile(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"/hello.txt"</span>, <span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"/foo.txt"</span>);
  readFile(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"/foo.txt"</span>);
  deleteFile(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"/foo.txt"</span>);
  testFileIO(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"/test.txt"</span>);
  deleteFile(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"/test.txt"</span>);
  Serial.println( <span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"Test complete"</span> );
}
<span class="hljs-function" style="box-sizing: border-box; color: #61aeee;"><span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">void</span><span class="hljs-title" style="box-sizing: border-box;">loop</span><span class="hljs-params" style="box-sizing: border-box; color: #a6e22e;">()</span></span>{
}
<span class="hljs-function" style="box-sizing: border-box; color: #61aeee;"><span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">void</span><span class="hljs-title" style="box-sizing: border-box;">listDir</span><span class="hljs-params" style="box-sizing: border-box; color: #a6e22e;">(<span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">const</span><span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">char</span> * dirname)</span></span>{
  Serial.<span class="hljs-built_in" style="box-sizing: border-box; color: #e6c07b;">printf</span>(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"Listing directory: %s\r\n"</span>, dirname);
  Dir dir = SPIFFS.openDir(dirname);
  <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">while</span> (dir.next()) {
    Serial.print(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"File Name: "</span>); Serial.print(dir.fileName());
    <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">if</span>(dir.fileSize()) {
      File f = dir.openFile(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"r"</span>);
      Serial.print(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">", Size: "</span>); Serial.println(f.size());
    }
  }
}
<span class="hljs-function" style="box-sizing: border-box; color: #61aeee;"><span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">void</span><span class="hljs-title" style="box-sizing: border-box;">readFile</span><span class="hljs-params" style="box-sizing: border-box; color: #a6e22e;">(<span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">const</span><span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">char</span> * path)</span></span>{
  Serial.<span class="hljs-built_in" style="box-sizing: border-box; color: #e6c07b;">printf</span>(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"Reading file: %s\r\n"</span>, path);
  File file = SPIFFS.open(path, <span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"r"</span>);
  <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">if</span>(!file || file.isDirectory()){
    Serial.println(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"- failed to open file for reading"</span>);
    <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">return</span>;
  }
  Serial.println(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"read from file:"</span>);
  <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">while</span>(file.available()){
    Serial.write(file.read());
  }
}
<span class="hljs-function" style="box-sizing: border-box; color: #61aeee;"><span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">void</span><span class="hljs-title" style="box-sizing: border-box;">writeFile</span><span class="hljs-params" style="box-sizing: border-box; color: #a6e22e;">(<span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">const</span><span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">char</span> * path, <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">const</span><span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">char</span> * message)</span></span>{
  Serial.<span class="hljs-built_in" style="box-sizing: border-box; color: #e6c07b;">printf</span>(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"Writing file: %s\r\n"</span>, path);
  File file = SPIFFS.open(path, <span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"w"</span>);
  <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">if</span>(!file){
    Serial.println(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"failed to open file for writing"</span>);
    <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">return</span>;
  }
  <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">if</span>(file.print(message)){
    Serial.println(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"file written"</span>);
  } <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">else</span> {
    Serial.println(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"frite failed"</span>);
  }
}
<span class="hljs-function" style="box-sizing: border-box; color: #61aeee;"><span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">void</span><span class="hljs-title" style="box-sizing: border-box;">appendFile</span><span class="hljs-params" style="box-sizing: border-box; color: #a6e22e;">(<span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">const</span><span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">char</span> * path, <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">const</span><span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">char</span> * message)</span></span>{
  Serial.<span class="hljs-built_in" style="box-sizing: border-box; color: #e6c07b;">printf</span>(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"Appending to file: %s\r\n"</span>, path);
  File file = SPIFFS.open(path, <span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"a"</span>);
  <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">if</span>(!file){
    Serial.println(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"failed to open file for appending"</span>);
      <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">return</span>;
  }
  <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">if</span>(file.print(message)){
    Serial.println(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"message appended"</span>);
  } <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">else</span> {
    Serial.println(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"append failed"</span>);
  }
}
<span class="hljs-function" style="box-sizing: border-box; color: #61aeee;"><span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">void</span><span class="hljs-title" style="box-sizing: border-box;">renameFile</span><span class="hljs-params" style="box-sizing: border-box; color: #a6e22e;">(<span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">const</span><span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">char</span> * path1, <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">const</span><span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">char</span> * path2)</span></span>{
  Serial.<span class="hljs-built_in" style="box-sizing: border-box; color: #e6c07b;">printf</span>(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"Renaming file %s to %s\r\n"</span>, path1, path2);
  <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">if</span> (SPIFFS.rename(path1, path2)) {
    Serial.println(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"file renamed"</span>);
  } <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">else</span> {
    Serial.println(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"rename failed"</span>);
  }
}
<span class="hljs-function" style="box-sizing: border-box; color: #61aeee;"><span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">void</span><span class="hljs-title" style="box-sizing: border-box;">deleteFile</span><span class="hljs-params" style="box-sizing: border-box; color: #a6e22e;">(<span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">const</span><span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">char</span> * path)</span></span>{
  Serial.<span class="hljs-built_in" style="box-sizing: border-box; color: #e6c07b;">printf</span>(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"Deleting file: %s\r\n"</span>, path);
  <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">if</span>(SPIFFS.remove(path)){
    Serial.println(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"file deleted"</span>);
  } <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">else</span> {
    Serial.println(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"delete failed"</span>);
  }
}
<span class="hljs-function" style="box-sizing: border-box; color: #61aeee;"><span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">void</span><span class="hljs-title" style="box-sizing: border-box;">testFileIO</span><span class="hljs-params" style="box-sizing: border-box; color: #a6e22e;">(<span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">const</span><span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">char</span> * path)</span></span>{
  Serial.<span class="hljs-built_in" style="box-sizing: border-box; color: #e6c07b;">printf</span>(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"Testing file I/O with %s\r\n"</span>, path);
  <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">static</span><span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">uint8_t</span> buf[<span class="hljs-number" style="box-sizing: border-box; color: #d19a66;">512</span>];
  <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">size_t</span> len = <span class="hljs-number" style="box-sizing: border-box; color: #d19a66;">0</span>;
  File file = SPIFFS.open(path, <span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"w"</span>);
  <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">if</span>(!file){
    Serial.println(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"failed to open file for writing"</span>);
    <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">return</span>;
  }
  <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">size_t</span> i;
  Serial.print(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"writing"</span> );
  <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">uint32_t</span> start = millis();
  <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">for</span>(i=<span class="hljs-number" style="box-sizing: border-box; color: #d19a66;">0</span>; i&lt;<span class="hljs-number" style="box-sizing: border-box; color: #d19a66;">1024</span>; i++){      <span class="hljs-comment" style="box-sizing: border-box; color: #b18eb1; font-style: italic;">// ESP8266 - 1024</span><span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">if</span> ((i &amp; <span class="hljs-number" style="box-sizing: border-box; color: #d19a66;">0x001F</span>) == <span class="hljs-number" style="box-sizing: border-box; color: #d19a66;">0x001F</span>){
      Serial.print(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"."</span>);
    }
    file.write(buf, <span class="hljs-number" style="box-sizing: border-box; color: #d19a66;">512</span>);
  }
  Serial.println(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">""</span>);
  <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">uint32_t</span> end = millis() - start;
  Serial.<span class="hljs-built_in" style="box-sizing: border-box; color: #e6c07b;">printf</span>(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"%u bytes written in %u ms\r\n"</span>, <span class="hljs-number" style="box-sizing: border-box; color: #d19a66;">1024</span> * <span class="hljs-number" style="box-sizing: border-box; color: #d19a66;">512</span>, end);
  file.close();
  file = SPIFFS.open(path, <span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"r"</span>);
  start = millis();
  end = start;
  i = <span class="hljs-number" style="box-sizing: border-box; color: #d19a66;">0</span>;
  <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">if</span>(file &amp;&amp; !file.isDirectory()){
    len = file.size();
    <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">size_t</span> flen = len;
    start = millis();
    Serial.print(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"reading"</span> );
    <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">while</span>(len){
      <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">size_t</span> toRead = len;
      <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">if</span>(toRead &gt; <span class="hljs-number" style="box-sizing: border-box; color: #d19a66;">512</span>){
        toRead = <span class="hljs-number" style="box-sizing: border-box; color: #d19a66;">512</span>;
      }
      file.read(buf, toRead);
      <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">if</span> ((i++ &amp; <span class="hljs-number" style="box-sizing: border-box; color: #d19a66;">0x001F</span>) == <span class="hljs-number" style="box-sizing: border-box; color: #d19a66;">0x001F</span>){
        Serial.print(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"."</span>);
      }
      len -= toRead;
    }
    Serial.println(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">""</span>);
    end = millis() - start;
    Serial.<span class="hljs-built_in" style="box-sizing: border-box; color: #e6c07b;">printf</span>(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"%u bytes read in %u ms\r\n"</span>, flen, end);
    file.close();
  } <span class="hljs-keyword" style="box-sizing: border-box; color: #f92672;">else</span> {
    Serial.println(<span class="hljs-string" style="box-sizing: border-box; color: #98c379;">"failed to open file for reading"</span>);
  }
}</code>
   </pre>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">전체적인 테스트 흐름을 살펴보자.&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">1. setup() 함수에 진입하면 SPIFFS 파일 시스템을 포맷한다.&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">2. 루트 디렉토리의 파일 리스트를 읽어온다. (포맷했으므로 파일리스트는 출력되지 않는다.)</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">3. hello.txt 파일을 생성하고 스트링 "Hello"를 저장한다.</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">4. 저장한 hello.txt의 데이터를 읽어온다.&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">5. hello.txt 파일에 스트링 "World!\r\n"를 추가한다.&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">6. 데이터가 추가된 hello.txt 파일의 데이터를 읽어온다.&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">7. hello.txt 파일 이름을 foo.txt 파일로 변경한다.&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">8. 변경한 foo.txt 파일의 데이터를 읽어온다.&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">9. foo.txt 파일을 삭제한다.&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">10. test.txt 파일을 생성하고 쓰기 및 읽기 성능테스트를 한다.</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">11. test.txt 파일을 지운다.&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">아래는 시리얼 모니터에 출력된 내용이다.&nbsp; (CPU&nbsp;Frequency:&nbsp;160Mhz&nbsp;)</p>
<table border="1" style="color: #000000; font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; width: 6623px; border-style: solid; border-color: #99cefa; background-color: #f6f9fd;">
   <tbody>
      <tr>
         <td style="width: 6601px; padding: 10px;">
            <p>Writing&nbsp;file:&nbsp;/hello.txt&nbsp;<br />file&nbsp;written&nbsp;<br />Reading&nbsp;file:&nbsp;/hello.txt&nbsp;<br />read&nbsp;from&nbsp;file:&nbsp;<br />Hello&nbsp;Appending&nbsp;to&nbsp;file:&nbsp;/hello.txt&nbsp;<br />message&nbsp;appended&nbsp;<br />Reading&nbsp;file:&nbsp;/hello.txt&nbsp;<br />read&nbsp;from&nbsp;file:&nbsp;<br />Hello&nbsp;World!&nbsp;<br />Renaming&nbsp;file&nbsp;/hello.txt&nbsp;to&nbsp;/foo.txt&nbsp;<br />file&nbsp;renamed&nbsp;<br />Reading&nbsp;file:&nbsp;/foo.txt&nbsp;<br />read&nbsp;from&nbsp;file:&nbsp;<br />Hello&nbsp;World!&nbsp;<br />Deleting&nbsp;file:&nbsp;/foo.txt&nbsp;<br />file&nbsp;deleted&nbsp;<br />Testing&nbsp;file&nbsp;I/O&nbsp;with&nbsp;/test.txt&nbsp;<br />writing................................&nbsp;<br />524288&nbsp;bytes&nbsp;written&nbsp;in&nbsp;6431&nbsp;ms&nbsp;<br />reading................................&nbsp;<br />524288&nbsp;bytes&nbsp;read&nbsp;in&nbsp;173&nbsp;ms&nbsp;<br />Deleting&nbsp;file:&nbsp;/test.txt&nbsp;<br />file&nbsp;deleted&nbsp;<br />Test&nbsp;complete</p>
            </td>
         </tr>
      </tbody>
   </table>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">&nbsp;</p>
<div style="box-sizing: border-box; font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1; position: relative; text-align: center; overflow: hidden; margin: auto;"><ins class="adsbygoogle" data-ad-client="ca-pub-8269928309278636" data-ad-slot="1013416775" data-ad-format="auto" data-full-width-responsive="true" data-adsbygoogle-status="done" style="display: block; height: 280px;"><ins id="aswift_3_expand" style="display: inline-table; border: none; height: 280px; margin: 0px; padding: 0px; position: relative; visibility: visible; width: 879px; background-color: transparent;"><ins id="aswift_3_anchor" style="display: block; border: none; height: 280px; margin: 0px; padding: 0px; position: relative; visibility: visible; width: 879px; background-color: transparent; overflow: visible;"><iframe id="aswift_3" name="aswift_3" sandbox="allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-top-navigation-by-user-activation" width="879" height="280" frameborder="0" src="https://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-8269928309278636&amp;output=html&amp;h=280&amp;slotname=1013416775&amp;adk=576060380&amp;adf=92370475&amp;w=879&amp;fwrn=4&amp;fwrnh=100&amp;lmt=1597037833&amp;rafmt=1&amp;psa=1&amp;guci=2.2.0.0.2.2.0.0&amp;format=879x280&amp;url=https%3A%2F%2Fpostpop.tistory.com%2F97%3Fcategory%3D744994&amp;flash=0&amp;fwr=0&amp;fwrattr=true&amp;rpe=1&amp;resp_fmts=3&amp;wgl=1&amp;adsid=ChEI8L2--QUQ0tq16-2fjYqgARIqAO0FjTH2X4ovhdExS6bKOi7R9f0NygxK9IBK2VhOLFsQTLsM8j4Yinsr&amp;dt=1597037829912&amp;bpp=5&amp;bdt=362&amp;idt=244&amp;shv=r20200805&amp;cbv=r20190131&amp;ptt=9&amp;saldr=aa&amp;abxe=1&amp;cookie=ID%3D720ca2025ee5b318%3AT%3D1597021416%3AS%3DALNI_MbwB0RmCu8y8M7-tE67Lg-ncQLpkQ&amp;prev_fmts=0x0%2C300x250%2C728x90&amp;nras=1&amp;correlator=8762422388933&amp;frm=20&amp;pv=1&amp;ga_vid=190590715.1597021417&amp;ga_sid=1597037830&amp;ga_hid=661654081&amp;ga_fc=0&amp;iag=0&amp;icsg=2402057231269888&amp;dssz=86&amp;mdo=0&amp;mso=0&amp;u_tz=540&amp;u_his=22&amp;u_java=0&amp;u_h=1440&amp;u_w=2560&amp;u_ah=1400&amp;u_aw=2560&amp;u_cd=24&amp;u_nplug=3&amp;u_nmime=4&amp;adx=336&amp;ady=8625&amp;biw=1261&amp;bih=1287&amp;scr_x=0&amp;scr_y=6403&amp;eid=42530558%2C42530560%2C21066393&amp;oid=3&amp;psts=AGkb-H9vm-ebKfiQiL6J6ZRCOsNYZdq7zz-BKZbjnnbLedSnYHdcLZk6IG8YZ6g3rD70%2CAGkb-H-HiZncntkZFO4Q8FjvzTHhIOJTXRpbrjjvV9hszY8eGKBZSVSWHfP2sDQ-Oy1L7g&amp;pvsid=2275327659788414&amp;pem=173&amp;ref=https%3A%2F%2Fpostpop.tistory.com%2F95%3Fcategory%3D744994&amp;rx=0&amp;eae=0&amp;fc=1920&amp;brdim=-7%2C40%2C-7%2C40%2C2560%2C40%2C1294%2C1407%2C1278%2C1287&amp;vis=1&amp;rsz=%7C%7CeoEbr%7C&amp;abl=CS&amp;pfx=0&amp;fu=8320&amp;bc=31&amp;jar=2020-08-10-04&amp;ifi=3&amp;uci=a!3&amp;btvi=2&amp;fsb=1&amp;xpc=nLWSJ1vV3f&amp;p=https%3A//postpop.tistory.com&amp;dtd=3166" marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true" scrolling="no" allowfullscreen="true" data-google-container-id="a!3" data-google-query-id="CMKHs8X1j-sCFUjDTAIdrMUHQg" data-load-complete="true" style="max-width: 100%; left: 0px; position: absolute; top: 0px; border-width: 0px; border-style: initial; width: 879px; height: 280px;"></iframe></ins></ins></ins></div>
<div style="box-sizing: border-box; font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1; position: relative; text-align: center; overflow: hidden; margin: auto;"><ins class="kakao_ad_area" data-ad-unit="DAN-vb6t3hamcup1" data-ad-width="728" data-ad-height="90" id="kakao_ad_gh4bHx_119" data-ad-rfseq="5" data-ad-rendered="Y" data-ad-request-id="6c38b0e2-367c-4e16-8ec1-93886b3435ea" data-ad-rfinterval="30" data-ad-bordercolor="unknown" data-ad-action="" data-ad-actioninterval="0" data-ad-refreshlimit="0" data-ad-noadmaxcount="10" data-ad-noadseq="0" data-ad-status="done" style="display: inline-block; text-decoration-line: none; min-width: 728px; min-height: 90px; width: 728px; height: 90px;">
      <div data-ad-creative-wrap="outer" style="box-sizing: border-box; overflow: hidden; position: relative; min-width: 728px; min-height: 90px; max-height: inherit;">
         <div data-ad-creative-wrap="inner" style="box-sizing: border-box; overflow: hidden; height: 90px;"><iframe frameborder="0" scrolling="no" marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true" id="adfit_frame_id_WOvmDY_5571" name="adfit_frame_id_WOvmDY_5571" style="max-width: 100%; min-width: 728px; width: 728px; min-height: 90px; height: 90px; display: block; border-width: 0px; border-style: initial; margin: 0px auto;"></iframe></div>
         </div>
      </ins></div>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">상기 예제에 사용된 SPIFFS 제어용 코드들에 대해 살펴보자.&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">SPIFFS.begin();&nbsp;//&nbsp;SPIFFS&nbsp;파일&nbsp;시스템을&nbsp;마운트,&nbsp;성공:&nbsp;true,&nbsp;실패:&nbsp;false&nbsp;반환</p>
<blockquote data-ke-style="style2" style="font-size: 16px; line-height: 1.6; color: #555555; position: relative; font-style: italic; margin: 0px; padding: 10px 15px; border-left: 5px solid rgb(241, 241, 241); font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; background-color: #f1f1f1;">setup() 함수에서 플래그 리턴값을 사용하여 SPIFFS 파일 시스템 시작에 대한 메시지를 출력한다.&nbsp;</blockquote>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">SPIFFS.format();&nbsp;//&nbsp;파일&nbsp;시스템을&nbsp;포맷,&nbsp;포맷&nbsp;성공:&nbsp;true&nbsp;반환&nbsp;</p>
<blockquote data-ke-style="style2" style="font-size: 16px; line-height: 1.6; color: #555555; position: relative; font-style: italic; margin: 0px; padding: 10px 15px; border-left: 5px solid rgb(241, 241, 241); font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; background-color: #f1f1f1;">setup() 함수 초기 진입시 테스트를 위해 SPIFFS 파일시스템의 파일들을 모두 지운다.&nbsp;</blockquote>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">SPIFFS.info();&nbsp;&nbsp;// FSInfo 구조체에 파일 시스템 정보를 채운다. - 성공하면 true 반환&nbsp;</p>
<blockquote data-ke-style="style2" style="font-size: 16px; line-height: 1.6; color: #555555; position: relative; font-style: italic; margin: 0px; padding: 10px 15px; border-left: 5px solid rgb(241, 241, 241); font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; background-color: #f1f1f1;">FSInfo&nbsp;fsInfo;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;파일시스템&nbsp;스트럭쳐&nbsp;객체&nbsp;선언&nbsp;<br />SPIFFS.info(fsInfo);&nbsp;//&nbsp;파일시트템&nbsp;정보&nbsp;값&nbsp;확인&nbsp;및&nbsp;저장&nbsp;<br />Serial.print("totalBytes:&nbsp;");&nbsp;Serial.println(fsInfo.totalBytes);&nbsp;//&nbsp;스트럭쳐&nbsp;변수에&nbsp;접근&nbsp;원하는&nbsp;값을&nbsp;불러온다.&nbsp;<br />Serial.print("usedBytes:&nbsp;");&nbsp;Serial.println(fsInfo.usedBytes);&nbsp;&nbsp;&nbsp;//&nbsp;스트럭쳐&nbsp;변수에&nbsp;접근&nbsp;원하는&nbsp;값을&nbsp;불러온다.&nbsp;</blockquote>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">&nbsp;</p>
<table border="1" style="color: #000000; font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; width: 6623px; border-style: solid; border-color: #99cefa; background-color: #f6f9fd;">
   <tbody>
      <tr>
         <td style="width: 6601px; padding: 10px;">
            <p>Filesystem&nbsp;information&nbsp;structure&nbsp;<br />struct&nbsp;FSInfo&nbsp;{&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;size_t&nbsp;totalBytes;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;size_t&nbsp;usedBytes;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;size_t&nbsp;blockSize;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;size_t&nbsp;pageSize;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;size_t&nbsp;maxOpenFiles;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;size_t&nbsp;maxPathLength;&nbsp;<br />};</p>
            </td>
         </tr>
      </tbody>
   </table>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">SPIFFS.openDir(path); // 절대 경로가 지정된 디렉토리를 연다. Dir 객체를 리턴&nbsp;</p>
<blockquote data-ke-style="style2" style="font-size: 16px; line-height: 1.6; color: #555555; position: relative; font-style: italic; margin: 0px; padding: 10px 15px; border-left: 5px solid rgb(241, 241, 241); font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; background-color: #f1f1f1;">SPIFFS 디렉토리 객체(Dir)를 선언하고 사용해야 한다. (예: Dir test = SPIFFS.openDir(path);</blockquote>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">listDir() 사용자 함수에서 루트('/') 디렉토리에 있는 파일 리스트를 확인하고 출력하도록 사용하였다. 초기 진입시 SPIFFS 파일 시스템을 포맷하므로 파일 리스트는 출력되지 않는다.&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">SPIFFS.open(path,&nbsp;mode);&nbsp; // 파일 열기(경로, 액세스 모드), 파일이 열리면 true 반환</p>
<blockquote data-ke-style="style2" style="font-size: 16px; line-height: 1.6; color: #555555; position: relative; font-style: italic; margin: 0px; padding: 10px 15px; border-left: 5px solid rgb(241, 241, 241); font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; background-color: #f1f1f1;">SPIFFS 파일 객체(File)를 선언하고 사용해야 한다. (예: File test = SPIFFS.open("/test.txt", "r");&nbsp;</blockquote>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">&nbsp;</p>
<table border="1" style="color: #000000; font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; width: 6623px; border-style: solid; border-color: #99cefa; background-color: #f6f9fd;">
   <tbody>
      <tr>
         <td style="width: 6601px; padding: 10px;">
            <p>path:&nbsp;'/'로&nbsp;시작하는&nbsp;절대&nbsp;경로(예:&nbsp;"/dir/filename.txt")이며 절대 경로의 길이는 '/', 이름, ',' 및 확장자 포함하는 최대 31문자까지 사용할 수 있다.&nbsp;<br />mode(액세스&nbsp;모드):&nbsp;&nbsp;표현 "r", "w", "a", "r+", "w+", "a+"<br />r&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 읽기전용&nbsp;&nbsp;<br />w&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;쓰기-&nbsp;파일이&nbsp;없으면&nbsp;파일을&nbsp;만들고,&nbsp;있으면&nbsp;파일크기를&nbsp;0으로&nbsp;만든후&nbsp;처음&nbsp;부터&nbsp;쓰기시작&nbsp;&nbsp;<br />a&nbsp;&nbsp;&nbsp;&nbsp;// 쓰기(추가) - 파일이 없으면 파일을 만들고, 있으면 파일의 맨 마지막부터 쓰기시작&nbsp;&nbsp;<br />r +&nbsp;&nbsp;// 먼저 읽고 쓰기 - 파일의 처음부터 쓰기 시작&nbsp;<br />w + // 먼저 읽고 쓰기 - 파일이 없으면 파일을 만들고, 있으면 파일크기를 0으로 만든후 처음 부터 쓰기시작&nbsp;&nbsp;<br />a + // 먼저 읽고 쓰기 - 파일이 없으면 파일을 만들고, 있으면 파일의 맨 처음부터 읽고, 맨 마지막부터 쓰기시작&nbsp;</p>
            </td>
         </tr>
      </tbody>
   </table>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">모드 a(추가)를 제외한 쓰기는 쓸때마다 파일 크기를 0으로 만든다음(모두 지운다음) 다시 쓴다는데 주의를 해야한다. EEPROM 처럼 특정인덱스의 값만 바꾸는 것이 아니다. 먼저 읽고 쓰기는 이러한 특성에 기인해 필요한 기능이다. 저장된 데이터의 일부만을 수정하고자 한다면 필요에 따라서 데이터를 읽어 분리 시킨다음 수정할 부분을 수정한후 다시 합쳐서 저장하는 개념이다(거의 사용하지 않는다).&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">readFile(), writeFile(), appendFile(), testFileIO() 사용자 함수에서 사용되었다.&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">불리언 리턴값을 이용한 파일 열기의 확인&nbsp;</p>
<table border="1" style="color: #000000; font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; width: 6623px; border-style: solid; border-color: #99cefa; background-color: #f6f9fd;">
   <tbody>
      <tr>
         <td style="width: 6601px; padding: 10px;">
            <p>File f =&nbsp;SPIFFS.open("/f.txt",&nbsp;"w");&nbsp;<br />&nbsp;&nbsp;if&nbsp;(!f)&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;파일&nbsp;오픈&nbsp;확인&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Serial.println("file&nbsp;open&nbsp;failed");&nbsp;<br />&nbsp;&nbsp;}&nbsp;</p>
            </td>
         </tr>
      </tbody>
   </table>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">SPIFFS.rename(pathFrom,&nbsp;pathTo); // (대상파일 경로 및 이름, 변경할 파일 경로 및 이름)&nbsp;파일의 이름이 성공적으로 변경되면 true를 반환&nbsp;</p>
<blockquote data-ke-style="style2" style="font-size: 16px; line-height: 1.6; color: #555555; position: relative; font-style: italic; margin: 0px; padding: 10px 15px; border-left: 5px solid rgb(241, 241, 241); font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; background-color: #f1f1f1;">renameFile() 사용자 함수에서 사용되었다.&nbsp;</blockquote>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">SPIFFS.remove(path);&nbsp;// 절대 경로가 지정된 파일을 삭제한다. 파일이 삭제 된 경우 true를 반환&nbsp;</p>
<blockquote data-ke-style="style2" style="font-size: 16px; line-height: 1.6; color: #555555; position: relative; font-style: italic; margin: 0px; padding: 10px 15px; border-left: 5px solid rgb(241, 241, 241); font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; background-color: #f1f1f1;">deleteFile() 사용자 함수에서 삭제와 동시에 반환되는 리턴값을 이용하여 메시지를 출력 하고있다.&nbsp;&nbsp;</blockquote>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&quot;; font-size: 16px; background-color: #f1f1f1;">&nbsp;</p>
<p style="font-family: &quot;Ubuntu Condensed&quot;, &quot;Noto Sans Korean&qu