{"id":1532,"date":"2024-04-02T15:04:44","date_gmt":"2024-04-02T14:04:44","guid":{"rendered":"https:\/\/ibex.tech\/c\/?p=1532"},"modified":"2026-06-17T09:25:03","modified_gmt":"2026-06-17T08:25:03","slug":"printf-a-buffer","status":"publish","type":"post","link":"https:\/\/ibex.tech\/c\/c\/console\/printf-a-buffer","title":{"rendered":"printf a buffer"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">Output Buffer<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/*****************************************\n\/\/*****************************************\n\/\/********** DEBUG OUTPUT BUFFER **********\n\/\/*****************************************\n\/\/*****************************************\nvoid DebugOutputBuffer (uint8_t* Buffer, int Length)\n{\n\tint Index;\n\tfor (Index = 0; Index &lt; Length; Index++)\n\t{\n\t\tprintf(\"%02X \", Buffer&#91;Index]);\n\t\tif (( Index + 1 ) % 16 == 0)\n\t\t{\n\t\t\tprintf(\"\\n\");\n\t\t\t\/\/vTaskDelay(10 \/ portTICK_PERIOD_MS);\t\/\/&lt;You may need this to avoid overloading FreeRTOS for big buffers\n\t\t}\n\n\t\tif (( Index + 1 ) % 256 == 0)\n\t\t{\n\t\t\tprintf(\"\\n\");\n\t\t}\n\n\t}\n\tprintf(\"\\n\");\n}<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Output null terminated buffer<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/*****************************************\n\/\/*****************************************\n\/\/********** DEBUG OUTPUT BUFFER **********\n\/\/*****************************************\n\/\/*****************************************\nvoid DebugOutputNullTerminatedBuffer (char* Buffer)\n{\n\tint Index = 0;\n\n\twhile (Buffer&#91;Index] != 0x00)\n\t{\n\t\tprintf(\"%02X \", Buffer&#91;Index]);\n\t\tif (( Index + 1 ) % 16 == 0)\n\t\t{\n\t\t\tprintf(\"\\n\");\n\t\t\t\/\/vTaskDelay(10 \/ portTICK_PERIOD_MS);\t\/\/&lt;You may need this to avoid overloading FreeRTOS for big buffers\n\t\t}\n\n\t\tif (( Index + 1 ) % 256 == 0)\n\t\t{\n\t\t\tprintf(\"\\n\");\n\t\t}\n\t\t\n\t\tIndex++;\n\t}\n\tprintf(\"\\n\");\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Output Buffer Output null terminated buffer<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[111],"tags":[],"class_list":["post-1532","post","type-post","status-publish","format-standard","hentry","category-console"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/posts\/1532","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/comments?post=1532"}],"version-history":[{"count":7,"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/posts\/1532\/revisions"}],"predecessor-version":[{"id":1540,"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/posts\/1532\/revisions\/1540"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/media?parent=1532"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/categories?post=1532"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/tags?post=1532"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}