{"id":6242,"date":"2014-04-14T03:22:15","date_gmt":"2014-04-14T03:22:15","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/14\/c-string-replacing-backslashes-collection-of-common-programming-errors\/"},"modified":"2014-04-14T03:22:15","modified_gmt":"2014-04-14T03:22:15","slug":"c-string-replacing-backslashes-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/14\/c-string-replacing-backslashes-collection-of-common-programming-errors\/","title":{"rendered":"C string replacing backslashes-Collection of common programming errors"},"content":{"rendered":"<p>I currently using C string headers and C++ and have hit a problem. I have a long path:<\/p>\n<pre><code>C:\\bla\\bla\\bla\\bla\n<\/code><\/pre>\n<p>I need to change the backslashes to double backslashes so that my <code>OS_CopyFile()<\/code> function can read it properly but I don&#8217;t know how?<\/p>\n<p>I get my path using:<\/p>\n<pre><code>CHAR* szValueBuf = NULL;\nDWORD cchValueBuf = 0;\nUINT uiStat =  MsiGetProperty(hInstall, TEXT(\"OriginalDatabase\"), TEXT(\"\"), &amp;cchValueBuf);\n\nif (ERROR_MORE_DATA == uiStat)\n{\n    ++cchValueBuf; \n    szValueBuf = new TCHAR[cchValueBuf];\n    if (szValueBuf)\n    {\n        uiStat = MsiGetProperty(hInstall, TEXT(\"OriginalDatabase\"), szValueBuf, &amp;cchValueBuf);\n    }\n}\nif (ERROR_SUCCESS != uiStat)\n{\n    if (szValueBuf != NULL) \n        delete[] szValueBuf;\n    return ERROR_INSTALL_FAILURE;\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I currently using C string headers and C++ and have hit a problem. I have a long path: C:\\bla\\bla\\bla\\bla I need to change the backslashes to double backslashes so that my OS_CopyFile() function can read it properly but I don&#8217;t know how? I get my path using: CHAR* szValueBuf = NULL; DWORD cchValueBuf = 0; [&hellip;]<\/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-6242","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6242","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=6242"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6242\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6242"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6242"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6242"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}