<?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 Re: C question in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/c-question/m-p/4478178#M95893</link>
    <description>OpenVMS native APIs are different from C native APIs; this is an area that causes confusion for C programmers new to OpenVMS.&lt;BR /&gt;&lt;BR /&gt;Details on creating, managing and correctly allocating and deallocating string descriptors are posted around the network.   Start with reading through the OpenVMS Programming Concepts Manual (in the OpenVMS manual shelf), and the C guide in the C documentation shelf.  That investment will save you time, and it'll also help improve your coding prowess.  These two shelves are reachable via the URL:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.hp.com/go/openvms/doc" target="_blank"&gt;http://www.hp.com/go/openvms/doc&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;As for the C compilation:&lt;BR /&gt;&lt;BR /&gt;$ CC /WARN=ENABLE=QUESTCODE&lt;BR /&gt;&lt;BR /&gt;can tend to help spot various C coding errors, and unstable code.  Yes, it makes the C compiler get rather fussy about syntax and structure and such.&lt;BR /&gt;&lt;BR /&gt;And here (and as a general comment), always specify and always verify the return status (condition) values from calls such as the lib$put_output routines used here.  Production code is most stable when errors are consistently checked, uniformly processed, and appropriately reported.  That can help identify the specific trigger for these sorts of error cases more quickly.&lt;BR /&gt;</description>
    <pubDate>Wed, 12 Aug 2009 17:32:51 GMT</pubDate>
    <dc:creator>Hoff</dc:creator>
    <dc:date>2009-08-12T17:32:51Z</dc:date>
    <item>
      <title>C question</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/c-question/m-p/4478173#M95888</link>
      <description>Why don't I get any output for lib$put_output but works fine with printf ?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Wed, 12 Aug 2009 14:23:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/c-question/m-p/4478173#M95888</guid>
      <dc:creator>Mulder_1</dc:creator>
      <dc:date>2009-08-12T14:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: C question</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/c-question/m-p/4478174#M95889</link>
      <description>&lt;!--!*#--&gt;If you want us to debug your code, it would help if you would include the code so we could look for the bug.&lt;BR /&gt;&lt;BR /&gt;But I'll make a wild guess anyway.  You might be passing a string by reference to lib$put_output:&lt;BR /&gt;&lt;BR /&gt;lib$put_output("this won't write out");&lt;BR /&gt;&lt;BR /&gt;which is not the correct argument for this routine, as you would see if you did:&lt;BR /&gt;$ HELP RTL LIB$ LIB$PUT_OUTPUT argument&lt;BR /&gt;&lt;BR /&gt;You must set up a string descriptor and pass that instead.  String descriptors are structures that contain the address and length of the string, so no assumption about zero-byte termination is necessary.&lt;BR /&gt; &lt;BR /&gt;#include &lt;DESCRIP.H&gt;&lt;BR /&gt;auto $DESCRIPTOR(string_descrip,"This will write out.");&lt;BR /&gt;lib$put_output(&amp;amp;string_descrip);&lt;BR /&gt;&lt;/DESCRIP.H&gt;</description>
      <pubDate>Wed, 12 Aug 2009 14:56:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/c-question/m-p/4478174#M95889</guid>
      <dc:creator>Jess Goodman</dc:creator>
      <dc:date>2009-08-12T14:56:45Z</dc:date>
    </item>
    <item>
      <title>Re: C question</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/c-question/m-p/4478175#M95890</link>
      <description>&lt;!--!*#--&gt;Sorry, your attachment did not show up the first time I viewed the page.&lt;BR /&gt;&lt;BR /&gt;LIB$PUT_OUTPUT only takes one argument.  If your want to use C style output formats you must first use sprintf() to write to a string in memory, fill in a descriptor with the address of the string and the resulting strlen() of it, and then pass the descriptor to lib$put_output.</description>
      <pubDate>Wed, 12 Aug 2009 15:07:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/c-question/m-p/4478175#M95890</guid>
      <dc:creator>Jess Goodman</dc:creator>
      <dc:date>2009-08-12T15:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: C question</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/c-question/m-p/4478176#M95891</link>
      <description>&lt;!--!*#--&gt;&amp;gt; LIB$PUT_OUTPUT only takes one argument.&lt;BR /&gt;&amp;gt; [...]&lt;BR /&gt;&lt;BR /&gt;For a more timely complaint about such a&lt;BR /&gt;usage problem, defining __NEW_STARLET seems&lt;BR /&gt;to be effective:&lt;BR /&gt;&lt;BR /&gt;alp $ cxx /define = (__NEW_STARLET=1) 336875.TXT&lt;BR /&gt;&lt;BR /&gt;lib$put_output("Value \n ",&amp;amp;str_dsc);&lt;BR /&gt;...........................^&lt;BR /&gt;%CXX-E-MANYARGUMENTS, too many arguments in function call&lt;BR /&gt;at line number 21 in file ALP$DKA0:[SMS.ITRC]336875.TXT;1&lt;BR /&gt;&lt;BR /&gt;lib$put_output("Value \n ",&amp;amp;a);&lt;BR /&gt;...........................^&lt;BR /&gt;%CXX-E-MANYARGUMENTS, too many arguments in function call&lt;BR /&gt;at line number 22 in file ALP$DKA0:[SMS.ITRC]336875.TXT;1&lt;BR /&gt;&lt;BR /&gt;%CXX-I-MESSAGE, 2 errors detected in the compilation of "ALP$DKA0:[SMS.ITRC]336875.TXT;1".&lt;BR /&gt;&lt;BR /&gt;Inspection of lib$routines.h shows why.&lt;BR /&gt;&lt;BR /&gt;Also, as&lt;BR /&gt;      HELP RTL_ROUTINES LIB$ LIB$PUT_OUTPUT&lt;BR /&gt;says,&lt;BR /&gt;&lt;BR /&gt;      The Put Line to SYS$OUTPUT routine&lt;BR /&gt;      writes a record to the current&lt;BR /&gt;      controlling output device, specified by&lt;BR /&gt;      SYS$OUTPUT using the OpenVMS RMS $PUT&lt;BR /&gt;      service.&lt;BR /&gt;&lt;BR /&gt;I'd guess that you don't really want one&lt;BR /&gt;message split across multiple records.&lt;BR /&gt;&lt;BR /&gt;And you're using lib$put_output() why,&lt;BR /&gt;exactly?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;You said "C question", but around here,&lt;BR /&gt;&lt;BR /&gt;alp $ cc 336875.TXT&lt;BR /&gt;&lt;BR /&gt;#include&lt;IOSTREAM.H&gt;&lt;BR /&gt;.^&lt;BR /&gt;%CC-F-NOINCLFILEF, Cannot find file &lt;IOSTREAM.H&gt; specified in #include directive.&lt;BR /&gt;at line number 2 in file ALP$DKA0:[SMS.ITRC]336875.TXT;1&lt;BR /&gt;&lt;BR /&gt;CXX worked better for me.&lt;/IOSTREAM.H&gt;&lt;/IOSTREAM.H&gt;</description>
      <pubDate>Wed, 12 Aug 2009 16:19:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/c-question/m-p/4478176#M95891</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2009-08-12T16:19:38Z</dc:date>
    </item>
    <item>
      <title>Re: C question</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/c-question/m-p/4478177#M95892</link>
      <description>You may also want to check out SYS$FAO to format a message string and feed it variables before to be assembled into an output descriptor, before using that descriptor for LIB$PUT_OUTPUT.&lt;BR /&gt;&lt;BR /&gt;sprintf is fine as well. If you use that, then use its Return_Values to set the length into the descriptor. "The number of characters placed in the output string, not including the final null character."&lt;BR /&gt;&lt;BR /&gt;Hein&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 12 Aug 2009 17:06:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/c-question/m-p/4478177#M95892</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2009-08-12T17:06:05Z</dc:date>
    </item>
    <item>
      <title>Re: C question</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/c-question/m-p/4478178#M95893</link>
      <description>OpenVMS native APIs are different from C native APIs; this is an area that causes confusion for C programmers new to OpenVMS.&lt;BR /&gt;&lt;BR /&gt;Details on creating, managing and correctly allocating and deallocating string descriptors are posted around the network.   Start with reading through the OpenVMS Programming Concepts Manual (in the OpenVMS manual shelf), and the C guide in the C documentation shelf.  That investment will save you time, and it'll also help improve your coding prowess.  These two shelves are reachable via the URL:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.hp.com/go/openvms/doc" target="_blank"&gt;http://www.hp.com/go/openvms/doc&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;As for the C compilation:&lt;BR /&gt;&lt;BR /&gt;$ CC /WARN=ENABLE=QUESTCODE&lt;BR /&gt;&lt;BR /&gt;can tend to help spot various C coding errors, and unstable code.  Yes, it makes the C compiler get rather fussy about syntax and structure and such.&lt;BR /&gt;&lt;BR /&gt;And here (and as a general comment), always specify and always verify the return status (condition) values from calls such as the lib$put_output routines used here.  Production code is most stable when errors are consistently checked, uniformly processed, and appropriately reported.  That can help identify the specific trigger for these sorts of error cases more quickly.&lt;BR /&gt;</description>
      <pubDate>Wed, 12 Aug 2009 17:32:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/c-question/m-p/4478178#M95893</guid>
      <dc:creator>Hoff</dc:creator>
      <dc:date>2009-08-12T17:32:51Z</dc:date>
    </item>
  </channel>
</rss>

