{"id":83,"date":"2012-12-06T11:40:00","date_gmt":"2012-12-06T10:40:00","guid":{"rendered":"http:\/\/www.riedmann.it\/blog\/?p=83"},"modified":"2012-12-06T11:40:00","modified_gmt":"2012-12-06T10:40:00","slug":"reading-from-inifile-stringbuilder-64-byte-limit","status":"publish","type":"post","link":"https:\/\/blog.riedmann.it\/?p=83","title":{"rendered":"Reading from IniFile &#8211; StringBuilder 64 byte limit"},"content":{"rendered":"<p>Today I have lost nearly 4 hours because I had strange crashs in my Vulcan application.<\/p>\n<p>The error returned me to the VO times with the 5333 error &#8211; the GPF.<\/p>\n<p>I had this code:<\/p>\n<p><code>method GetString( cSection as string, cEntry as string, cDefault as string ) as string<br \/>\n\tlocal cReturn\t\t\tas string<br \/>\n\tlocal oReturn\t\t\tas System.Text.StringBuilder<\/p>\n<p>\toReturn\t\t\t\t:= System.Text.StringBuilder{}<\/p>\n<p>\tGetPrivateProfileString( cSection, cEntry, cDefault, oReturn, INI_STRING_LEN, _cFullPath )<br \/>\n\tcReturn\t\t\t\t:= oReturn:ToString() <\/p>\n<p>\treturn cReturn<\/code><\/p>\n<p>and sometimes it caused very strange crashes. <\/p>\n<p>I had to correct the code as follows:<\/p>\n<p><code>method GetString( cSection as string, cEntry as string, cDefault as string ) as string<br \/>\n\tlocal cReturn\t\t\tas string<br \/>\n\tlocal oReturn\t\t\tas System.Text.StringBuilder<\/p>\n<p>\toReturn\t\t\t\t:= System.Text.StringBuilder{ <strong>INI_STRING_LEN<\/strong> }<\/p>\n<p>\tGetPrivateProfileString( cSection, cEntry, cDefault, oReturn, INI_STRING_LEN, _cFullPath )<br \/>\n\tcReturn\t\t\t\t:= oReturn:ToString() <\/p>\n<p>\treturn cReturn<\/code><\/p>\n<p>because otherwise the StringBuilder class was initialized only with 64 byte and the API call corrupted the runtime memory. <\/p>\n<p>IMHO such an error should be detected by the stringbuilder class itself.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today I have lost nearly 4 hours because I had strange crashs in my Vulcan application. The error returned me to the VO times with the 5333 error &#8211; the GPF. I had this code: method GetString( cSection as string, cEntry as string, cDefault as string ) as string local cReturn as string local oReturn [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-83","post","type-post","status-publish","format-standard","hentry","category-vulcan-net-programming"],"_links":{"self":[{"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=\/wp\/v2\/posts\/83","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=83"}],"version-history":[{"count":1,"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=\/wp\/v2\/posts\/83\/revisions"}],"predecessor-version":[{"id":84,"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=\/wp\/v2\/posts\/83\/revisions\/84"}],"wp:attachment":[{"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=83"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=83"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=83"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}