{"id":3685,"date":"2014-03-29T07:56:41","date_gmt":"2014-03-29T07:56:41","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/29\/casting-into-a-python-string-from-a-char-returned-by-a-dll-collection-of-common-programming-errors\/"},"modified":"2014-03-29T07:56:41","modified_gmt":"2014-03-29T07:56:41","slug":"casting-into-a-python-string-from-a-char-returned-by-a-dll-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/29\/casting-into-a-python-string-from-a-char-returned-by-a-dll-collection-of-common-programming-errors\/","title":{"rendered":"casting into a Python string from a char[] returned by a DLL-Collection of common programming errors"},"content":{"rendered":"<p>ctypes.cast() is used to convert one ctype instance to another ctype datatype. You don&#8217;t need it To convert it to python string. Just use &#8220;.value&#8221; to get it in python string.<\/p>\n<pre><code>&gt;&gt;&gt; s = \"Hello, World\"\n&gt;&gt;&gt; c_s = c_char_p(s)\n&gt;&gt;&gt; print c_s\nc_char_p('Hello, World')\n&gt;&gt;&gt; print c_s.value\nHello, World\n<\/code><\/pre>\n<p>More info here<\/p>\n","protected":false},"excerpt":{"rendered":"<p>ctypes.cast() is used to convert one ctype instance to another ctype datatype. You don&#8217;t need it To convert it to python string. Just use &#8220;.value&#8221; to get it in python string. &gt;&gt;&gt; s = &#8220;Hello, World&#8221; &gt;&gt;&gt; c_s = c_char_p(s) &gt;&gt;&gt; print c_s c_char_p(&#8216;Hello, World&#8217;) &gt;&gt;&gt; print c_s.value Hello, World More info here<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3685","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3685","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=3685"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3685\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3685"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3685"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3685"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}