<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Unicode wcscpy_t  problem in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/unicode-wcscpy-t-problem/m-p/5820886#M10885</link>
    <description>&lt;P&gt;I've finished migrating my software to Unicode requirements, however I do have one issue for which I have searched at length but yet to find a solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;wcscpy_s (module_layer_objects_res_buf.resval.rstring, module_objects_layer);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;yeilds the following compile error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;error C2660: 'wcscpy_s' : function does not take 2 arguments&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Firstly, 'wcscpy_s' does in fact take two arguments. I works elswhere in my code just fine, so it's not clear just why the compiler (vs2012) produces this error code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Secondly, It seems to me&amp;nbsp;this a Unicode issue since the code listed above compiled just fine in vs2002 (non-unicode) using the 'srtcpy' finction where both arguments were 'char' data types.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thirdly, I expected&amp;nbsp;'wcscpy_s' to work fine in the Unicode environment where both arguments are the same data type - ACHAR in the union 'rstring', and wchar_t for 'module_objects_layer.' But no, 'wcscpy_s failed in this case.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, does anyone have an insight to what's going on here? Any help appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Brian (aka, manybeans)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 17 Sep 2015 07:08:21 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-09-17T07:08:21Z</dc:date>
    <item>
      <title>Unicode wcscpy_t  problem</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/unicode-wcscpy-t-problem/m-p/5820886#M10885</link>
      <description>&lt;P&gt;I've finished migrating my software to Unicode requirements, however I do have one issue for which I have searched at length but yet to find a solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;wcscpy_s (module_layer_objects_res_buf.resval.rstring, module_objects_layer);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;yeilds the following compile error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;error C2660: 'wcscpy_s' : function does not take 2 arguments&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Firstly, 'wcscpy_s' does in fact take two arguments. I works elswhere in my code just fine, so it's not clear just why the compiler (vs2012) produces this error code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Secondly, It seems to me&amp;nbsp;this a Unicode issue since the code listed above compiled just fine in vs2002 (non-unicode) using the 'srtcpy' finction where both arguments were 'char' data types.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thirdly, I expected&amp;nbsp;'wcscpy_s' to work fine in the Unicode environment where both arguments are the same data type - ACHAR in the union 'rstring', and wchar_t for 'module_objects_layer.' But no, 'wcscpy_s failed in this case.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, does anyone have an insight to what's going on here? Any help appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Brian (aka, manybeans)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2015 07:08:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/unicode-wcscpy-t-problem/m-p/5820886#M10885</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-09-17T07:08:21Z</dc:date>
    </item>
    <item>
      <title>Re: Unicode wcscpy_t  problem</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/unicode-wcscpy-t-problem/m-p/5820943#M10886</link>
      <description>&lt;P&gt;Maybe the compiler thinks this is a C, and not a C++ file? See:&lt;/P&gt;&lt;P&gt;&lt;A href="https://msdn.microsoft.com/de-de/library/td1esda9.aspx" target="_blank"&gt;https://msdn.microsoft.com/de-de/library/td1esda9.aspx&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2015 08:11:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/unicode-wcscpy-t-problem/m-p/5820943#M10886</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-09-17T08:11:51Z</dc:date>
    </item>
    <item>
      <title>Re: Unicode wcscpy_t  problem</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/unicode-wcscpy-t-problem/m-p/5821105#M10887</link>
      <description>&lt;P&gt;There are several overloads of wcscpy_s. Usually the compiler can infer the buffer size from the arguments to the function, but if it cannot, then you must supply the buffer size argument.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2015 10:46:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/unicode-wcscpy-t-problem/m-p/5821105#M10887</guid>
      <dc:creator>owenwengerd</dc:creator>
      <dc:date>2015-09-17T10:46:11Z</dc:date>
    </item>
    <item>
      <title>Re: Unicode wcscpy_t  problem</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/unicode-wcscpy-t-problem/m-p/5821125#M10888</link>
      <description>&lt;P&gt;"_tcscpy"&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2015 11:15:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/unicode-wcscpy-t-problem/m-p/5821125#M10888</guid>
      <dc:creator>nick83</dc:creator>
      <dc:date>2015-09-17T11:15:58Z</dc:date>
    </item>
    <item>
      <title>Re: Unicode wcscpy_t  problem</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/unicode-wcscpy-t-problem/m-p/5822732#M10889</link>
      <description>&lt;P&gt;All -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks all for your insights and suggestions. However still no solution to the wcscpy_t problem. I'm not sure this is an overload&amp;nbsp;issue since wcscpy_t takes two arguments and my wcscpy_t statement is a two argument statement. Also tried the various cpy forms, including _tcspy. These produce a compile error stating they may be unsafe and to try wcscpy_t instead.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that&amp;nbsp;I have numerous statements in my code&amp;nbsp;where wcscpy_t works just fine copying from the resbuf (general_layer_name is a resbuf) to a variable, which is just the reverse of my problem statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In other words this statement&amp;nbsp;builds just fine:&lt;/P&gt;&lt;P&gt;wcscpy_s (layer_name_buffer, general_layer_name.resval.rstring);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where&amp;nbsp;my&amp;nbsp;problem statement&amp;nbsp;does not:&lt;/P&gt;&lt;P&gt;wcscpy_s (general_layer_name.resval.rstring, layer_name_buffer);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As&amp;nbsp;I mentioned before, my problem statement here built just fine in the Visiual Studio 2002 C++ compiler using ObjectARX 2004. ObjectARX 2004 is pre Unicode.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ok. So that's about all the info I have so far. Just as general info, my application is about 107,000 lines in C++/ObjectARX 2012. It builds error/warning free, except for my one problem statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any further thoughts will be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Brian (aka, manybeans)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Sep 2015 08:41:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/unicode-wcscpy-t-problem/m-p/5822732#M10889</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-09-18T08:41:26Z</dc:date>
    </item>
    <item>
      <title>Re: Unicode wcscpy_t  problem</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/unicode-wcscpy-t-problem/m-p/5823816#M10890</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous wrote:&lt;BR /&gt;
&lt;P&gt;I'm not sure this is an overload&amp;nbsp;issue since wcscpy_t takes two arguments and my wcscpy_t statement is a two argument statement.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Folks at &lt;A href="http://stackoverflow.com" target="_self"&gt;stack overflow&lt;/A&gt;&amp;nbsp;are more likely to take time to explain what you're doing wrong. I recommend to post there to see if someone&amp;nbsp;can help.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Sep 2015 19:53:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/unicode-wcscpy-t-problem/m-p/5823816#M10890</guid>
      <dc:creator>owenwengerd</dc:creator>
      <dc:date>2015-09-18T19:53:17Z</dc:date>
    </item>
    <item>
      <title>Re: Unicode wcscpy_t  problem</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/unicode-wcscpy-t-problem/m-p/5825286#M10891</link>
      <description>&lt;P&gt;))) what about reading MSDN help?&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;wcscpy_s (layer_name_buffer, general_layer_name.resval.rstring);&lt;/STRONG&gt; &amp;nbsp;- works fine because your layer_name_buffer is declared like &lt;U&gt;ACHAR &amp;nbsp;layer_name_buffer[50];&lt;/U&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;lines from MSDN&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;errno_t wcscpy_s(
   wchar_t (&amp;amp;strDestination)[size],
   const wchar_t *strSource 
); // C++ only&lt;/PRE&gt;&lt;P&gt;BUT if you want &amp;nbsp;&lt;STRONG&gt;wcscpy_s (general_layer_name.resval.rstring, layer_name_buffer); &lt;/STRONG&gt;you have to use&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;errno_t wcscpy_s(
   wchar_t *strDestination,
   size_t numberOfElements,
   const wchar_t *strSource 
);&lt;/PRE&gt;&lt;P&gt;because&amp;nbsp;&lt;STRONG&gt;general_layer_name.resval.rstring &lt;/STRONG&gt;&lt;U&gt;is ACHAR*&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PS: try to use&amp;nbsp;&lt;STRONG&gt;acutUpdString(general_layer_name.resval.rstring, layer_name_buffer); &lt;/STRONG&gt;for modifying &lt;U&gt;resbuf&lt;/U&gt; string data&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Sep 2015 07:32:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/unicode-wcscpy-t-problem/m-p/5825286#M10891</guid>
      <dc:creator>nick83</dc:creator>
      <dc:date>2015-09-21T07:32:21Z</dc:date>
    </item>
    <item>
      <title>Re: Unicode wcscpy_t  problem</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/unicode-wcscpy-t-problem/m-p/5827035#M10892</link>
      <description>&lt;P&gt;Hi nick83,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&lt;FONT size="2"&gt;Very nice. I see then that wcscpy_s takes an overload that defines the rstring buffer size. And it works just fine. Thanks for the info.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&lt;FONT size="2"&gt;I searched the ObjectARX 2007 Unicode migration guide for wcscpy_s but found no info on overloads. Maybe it's really there but I just missed it.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&lt;FONT size="2"&gt;In any case I&amp;nbsp;had not&amp;nbsp;been to Microsoft yet on any Unicode issues. I don't have a MSDN subscription, but I did as you suggested and searched for wcscpy_s. Sure enough it came up with exactly the information you listed, and much more too. Thanks for the heads up there.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&lt;FONT size="2"&gt;manybeans&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2015 07:52:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/unicode-wcscpy-t-problem/m-p/5827035#M10892</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-09-22T07:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: Unicode wcscpy_t  problem</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/unicode-wcscpy-t-problem/m-p/5827120#M10893</link>
      <description>&lt;P&gt;i dont have MSDN subscription, too :), but i have a computer with internet &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;i looked through my code, and found an old ObjectARX function for setting data to resbuf's string field - "&lt;U&gt;acutUpdString&lt;/U&gt;". so, i changed nothing for unicode and forgot about this function. the rest of my code is just gets data from resbuf, so, _tcscmp is enough for me.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2015 09:01:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/unicode-wcscpy-t-problem/m-p/5827120#M10893</guid>
      <dc:creator>nick83</dc:creator>
      <dc:date>2015-09-22T09:01:49Z</dc:date>
    </item>
  </channel>
</rss>

