{"id":5238,"date":"2013-11-16T05:01:33","date_gmt":"2013-11-15T18:01:33","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=5238"},"modified":"2013-11-16T05:01:33","modified_gmt":"2013-11-15T18:01:33","slug":"xcode-debug-c-strings-program-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/xcode-debug-c-strings-program-tutorial\/","title":{"rendered":"Xcode Debug C Strings Program Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/C\/NonGlobalStrings\/XcodeDebug_C_NonGlobalStrings.m4v\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Xcode Debug C Strings Program Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/C\/NonGlobalStrings\/XcodeDebug_C_NonGlobalStrings.jpg\" title=\"Xcode Debug C Strings Program Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Xcode Debug C Strings Program Tutorial<\/p><\/div>\n<p>Have a bit of an esoteric C programming scenario today, and because it is esoteric, and some or all of you may fall asleep, am also going to show you how to debug in Xcode &#8230; and only now just realized with the podcast of this tutorial that we went, on a Mac, control-command-Y a lot and should have, instead, shown you this in menu manipulation terms as Product->Debug->Continue &#8230; anyway, if you get into this, you&#8217;ll know what is going on.<\/p>\n<p>Okay, so the C scenario in Xcode is a bit esoteric, as sometimes happens when you are answering &#8220;a brief&#8221; (a Yahoo Answers brief).  The brief was not to use <a target=_blank title='strcat' href='http:\/\/www.techonthenet.com\/c_language\/standard_library_functions\/string_h\/strcat.php'><i>strcat<\/i><\/a> in the making of a single string buffer from an array of zero-byte terminated char* strings in an array, with an added stipulation of a maximum string buffer length.   Sounds simple, and it is if you use <i>strcat<\/i> and\/or global strings, but my understanding of the brief would be that <a target=_blank title='Wikipedia information about global variables' href='http:\/\/en.wikipedia.org\/wiki\/Global_variable'>global variables<\/a> will be frowned upon, as a lot of programmers will tell you.   Mind you, personally, global strings are not a problem for me.   Not using global strings and not using <i>strcat<\/i>, and making this work in a self-sufficient single function is quite interesting, and basically that is what we do here with this tutorial, via memory management using <a target=_blank title='malloc' href='http:\/\/www.cplusplus.com\/reference\/cstdlib\/malloc\/'>malloc<\/a> &amp; <a target=_blank title='realloc' href='http:\/\/www.cplusplus.com\/reference\/cstdlib\/realloc\/?kw=realloc'>realloc<\/a>.<\/p>\n<p>So feel free to download the Xcode C programming source code here and rename it to <a target=_blank title='main.cpp' href='http:\/\/www.rjmprogramming.com.au\/C\/NonGlobalStrings\/main.cpp_GETME'>main.cpp<\/a> (or main.c &#8230; is pretty conservative in its construction &#8230; probably would work with Digital Mars C).<\/p>\n<p>Hope you enjoy this <a target=_blank title=\"Xcode debugging\" href=\"http:\/\/www.rjmprogramming.com.au\/C\/NonGlobalStrings\/XcodeDebug_C_NonGlobalStrings.m4v\">tutorial<\/a> showing you some cute Xcode debugging functionality.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d5238' onclick='var dv=document.getElementById(\"d5238\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?tag=Xcode\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d5238' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Have a bit of an esoteric C programming scenario today, and because it is esoteric, and some or all of you may fall asleep, am also going to show you how to debug in Xcode &#8230; and only now just &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/xcode-debug-c-strings-program-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,37,40],"tags":[176,307,500,997,1319,1473,1488],"class_list":["post-5238","post","type-post","status-publish","format-standard","hentry","category-elearning","category-tutorials","category-xcode","tag-c","tag-debugging","tag-global-string","tag-programming","tag-tutorial","tag-xcode","tag-yahoo-answers"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/5238"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=5238"}],"version-history":[{"count":0,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/5238\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=5238"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=5238"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=5238"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}