{"id":3236,"date":"2020-04-27T12:34:06","date_gmt":"2020-04-27T12:34:06","guid":{"rendered":"https:\/\/raspberry-projects.com\/pi\/?p=3236"},"modified":"2020-04-27T12:48:41","modified_gmt":"2020-04-27T12:48:41","slug":"using-char-values","status":"publish","type":"post","link":"https:\/\/raspberry-projects.com\/pi\/programming-in-c\/strings\/using-char-values","title":{"rendered":"Using char-Values"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">printf a value in a string<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>\n\tchar TempString&#91;256];\n\tchar ValueString&#91;32];\n\tstrcpy(TempString, \"&lt;span foreground=\\\"white\\\"  font_desc=\\\"\");\n\tsnprintf(ValueString, sizeof(ValueString), \"%d\", FONT_SIZE);\t\t\/\/Add value\n\tstrcat(TempString, ValueString);\n\tstrcat(TempString, \".0\\\">\");<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Conversion Functions<\/h4>\n\n\n\n<h5 class=\"wp-block-heading\">atoi \u2013 String To Int<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>\ninclude &lt;stdlib.h>\n\tint i = atoi(some_string_value);\n<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">itoa \u2013 Int&nbsp;To String<\/h5>\n\n\n\n<p>itoa is not part of ANSI C! &nbsp;You can use this instead:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\tchar s_remote_port&#91;6];\n\tremote_port = 10;\n\tsnprintf(s_remote_port, sizeof(s_remote_port), \"%d\", remote_port);<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>printf a value in a string Conversion Functions atoi \u2013 String To Int itoa \u2013 Int&nbsp;To String itoa is not part of ANSI C! &nbsp;You can use this instead:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30],"tags":[],"class_list":["post-3236","post","type-post","status-publish","format-standard","hentry","category-strings"],"_links":{"self":[{"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/posts\/3236","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/comments?post=3236"}],"version-history":[{"count":4,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/posts\/3236\/revisions"}],"predecessor-version":[{"id":3245,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/posts\/3236\/revisions\/3245"}],"wp:attachment":[{"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/media?parent=3236"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/categories?post=3236"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/tags?post=3236"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}