<?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 Reading the registry - garbage after string in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Reading-the-registry-garbage-after-string/m-p/766277#M20272</link>
    <description>I am trying to read a string value from the registry, but I get a lot of garbage at the end of the string. Here is my code:&lt;BR /&gt;&lt;BR /&gt;iLen = len(sValue) &lt;BR /&gt;if( RegOpenKeyEx(HKEY_LOCAL_MACHINE, sKeyName, 0, KEY_EXECUTE, loc(hKey) ) == ERROR_SUCCESS) then&lt;BR /&gt; retval = RegQueryValueEx( hKey, sValueName, NULL, NULL, loc(sValue), loc(iLen) )&lt;BR /&gt; ii = RegCloseKey(hKey)&lt;BR /&gt;endif&lt;BR /&gt;&lt;BR /&gt;The registry key is:&lt;BR /&gt;SOFTWARE\\AspenTech\\Aprsystem\\26.0\\aplus&lt;BR /&gt;&lt;BR /&gt;which contains:&lt;BR /&gt;"D:\\Program Files\\AspenTech\\APrSystem V7.3\\Engine"&lt;BR /&gt;&lt;BR /&gt;However sValue is returned as:&lt;BR /&gt;"D:\\Program Files\\AspenTech\\APrSystem V7.3\\Engine h \\ A P r S y s t e m V 7 . 3 \\ E n g i n e "&lt;BR /&gt;&lt;BR /&gt;It looks like it fills sValue with Unicode version of the string first, then overwrites the first part with the correct non-unicode version.</description>
    <pubDate>Wed, 24 Aug 2011 13:55:14 GMT</pubDate>
    <dc:creator>ferrad01</dc:creator>
    <dc:date>2011-08-24T13:55:14Z</dc:date>
    <item>
      <title>Reading the registry - garbage after string</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Reading-the-registry-garbage-after-string/m-p/766277#M20272</link>
      <description>I am trying to read a string value from the registry, but I get a lot of garbage at the end of the string. Here is my code:&lt;BR /&gt;&lt;BR /&gt;iLen = len(sValue) &lt;BR /&gt;if( RegOpenKeyEx(HKEY_LOCAL_MACHINE, sKeyName, 0, KEY_EXECUTE, loc(hKey) ) == ERROR_SUCCESS) then&lt;BR /&gt; retval = RegQueryValueEx( hKey, sValueName, NULL, NULL, loc(sValue), loc(iLen) )&lt;BR /&gt; ii = RegCloseKey(hKey)&lt;BR /&gt;endif&lt;BR /&gt;&lt;BR /&gt;The registry key is:&lt;BR /&gt;SOFTWARE\\AspenTech\\Aprsystem\\26.0\\aplus&lt;BR /&gt;&lt;BR /&gt;which contains:&lt;BR /&gt;"D:\\Program Files\\AspenTech\\APrSystem V7.3\\Engine"&lt;BR /&gt;&lt;BR /&gt;However sValue is returned as:&lt;BR /&gt;"D:\\Program Files\\AspenTech\\APrSystem V7.3\\Engine h \\ A P r S y s t e m V 7 . 3 \\ E n g i n e "&lt;BR /&gt;&lt;BR /&gt;It looks like it fills sValue with Unicode version of the string first, then overwrites the first part with the correct non-unicode version.</description>
      <pubDate>Wed, 24 Aug 2011 13:55:14 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Reading-the-registry-garbage-after-string/m-p/766277#M20272</guid>
      <dc:creator>ferrad01</dc:creator>
      <dc:date>2011-08-24T13:55:14Z</dc:date>
    </item>
    <item>
      <title>Reading the registry - garbage after string</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Reading-the-registry-garbage-after-string/m-p/766278#M20273</link>
      <description>Solved: I just set sValue(iLen:) = ' '</description>
      <pubDate>Wed, 24 Aug 2011 14:19:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Reading-the-registry-garbage-after-string/m-p/766278#M20273</guid>
      <dc:creator>ferrad01</dc:creator>
      <dc:date>2011-08-24T14:19:35Z</dc:date>
    </item>
    <item>
      <title>Reading the registry - garbage after string</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Reading-the-registry-garbage-after-string/m-p/766279#M20274</link>
      <description>This is probably due to C using a terminating character (char(0)). The C routines treat a string&lt;BR /&gt;up to that character - without regard to the actual length - whereas Fortran uses the actual length&lt;BR /&gt;and considers the whole string. The left-over stuff you saw is not usually visible on the C side,&lt;BR /&gt;but it is on the Fortran side.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Arjen</description>
      <pubDate>Wed, 24 Aug 2011 14:27:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Reading-the-registry-garbage-after-string/m-p/766279#M20274</guid>
      <dc:creator>Arjen_Markus</dc:creator>
      <dc:date>2011-08-24T14:27:38Z</dc:date>
    </item>
  </channel>
</rss>

