<p style="box-sizing: border-box; margin-bottom: 20px; font-family: &quot;Jeju Gothic&quot;, sans-serif; color: #666666; font-size: 13px; background-color: #ffffff;">아두이노에서 아래처럼 sprintf을 이용하여 문자열로 변경하려고 할때<br style="box-sizing: border-box;" />결과를 보면 ? 가 출력된다.</p>
<pre style="box-sizing: border-box; overflow: auto; font-family: Menlo, Monaco, Consolas, &quot;Courier New&quot;, monospace; font-size: 1.076em; padding: 9.5px; margin-top: 0px; margin-bottom: 10px; line-height: 1.42857; word-break: break-all; overflow-wrap: break-word; color: #333333; background-color: #f5f5f5; border: 1px solid rgb(204, 204, 204); border-radius: 4px;">sprintf(pChrBuffer, "%f", fltValue);
</pre>
<p style="box-sizing: border-box; margin-bottom: 20px; font-family: &quot;Jeju Gothic&quot;, sans-serif; color: #666666; font-size: 13px; background-color: #ffffff;">아두이노에서는 float형에 대해서 sprintf가 제대로 지원되지 않는듯하여,<br style="box-sizing: border-box;" />확인하여 보니 아래 함수를 이용하면 변환할수 있다.</p>
<pre style="box-sizing: border-box; overflow: auto; font-family: Menlo, Monaco, Consolas, &quot;Courier New&quot;, monospace; font-size: 1.076em; padding: 9.5px; margin-top: 0px; margin-bottom: 10px; line-height: 1.42857; word-break: break-all; overflow-wrap: break-word; color: #333333; background-color: #f5f5f5; border: 1px solid rgb(204, 204, 204); border-radius: 4px;">char * dtostrf(ouble __val, signed char __width, unsigned char __prec, char * __s);
</pre>
<pre style="box-sizing: border-box; overflow: auto; font-family: Menlo, Monaco, Consolas, &quot;Courier New&quot;, monospace; font-size: 1.076em; padding: 9.5px; margin-top: 0px; margin-bottom: 10px; line-height: 1.42857; word-break: break-all; overflow-wrap: break-word; color: #333333; background-color: #f5f5f5; border: 1px solid rgb(204, 204, 204); border-radius: 4px;">float fltValue = 123.456;
char pChrBuffer[50];
dtostrf(fltValue , 5, 2, pChrBuffer);  // 5 : width, 2 : precision
</pre>
<p style="box-sizing: border-box; margin-bottom: 20px; font-family: &quot;Jeju Gothic&quot;, sans-serif; color: #666666; font-size: 13px; background-color: #ffffff;">다른 방법으로는 String을 이용하여 아래와 같이 할수도 있다.</p>
<pre style="box-sizing: border-box; overflow: auto; font-family: Menlo, Monaco, Consolas, &quot;Courier New&quot;, monospace; font-size: 1.076em; padding: 9.5px; margin-top: 0px; margin-bottom: 10px; line-height: 1.42857; word-break: break-all; overflow-wrap: break-word; color: #333333; background-color: #f5f5f5; border: 1px solid rgb(204, 204, 204); border-radius: 4px;">String strValue = String(fltValue);</pre>