<?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: system() call question in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/system-call-question/m-p/4391503#M42007</link>
    <description>This question was answered in your other thread &amp;lt;&amp;gt;.  Steven Schweda gave you a complete example to do this.</description>
    <pubDate>Tue, 31 Mar 2009 19:58:47 GMT</pubDate>
    <dc:creator>RBrown_1</dc:creator>
    <dc:date>2009-03-31T19:58:47Z</dc:date>
    <item>
      <title>system() call question</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/system-call-question/m-p/4391502#M42006</link>
      <description>in using system() call in C how can I pass the parameter ?:&lt;BR /&gt;&lt;BR /&gt;    int sts;&lt;BR /&gt;    char *cmd = "mcr sys$system:tcpip$snmp_trapsnd.exe 0.0 local 0 0 0 -h 10.100.18.245 -v2c    1.3.6.1.6.3.1.1.4.1.0 \"D\" \"&amp;lt;&lt;PARAMETERHERE&gt; \"";&lt;BR /&gt;&lt;BR /&gt;sts = system( cmd);&lt;/PARAMETERHERE&gt;</description>
      <pubDate>Tue, 31 Mar 2009 19:40:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/system-call-question/m-p/4391502#M42006</guid>
      <dc:creator>SAMI AHMAD</dc:creator>
      <dc:date>2009-03-31T19:40:35Z</dc:date>
    </item>
    <item>
      <title>Re: system() call question</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/system-call-question/m-p/4391503#M42007</link>
      <description>This question was answered in your other thread &amp;lt;&amp;gt;.  Steven Schweda gave you a complete example to do this.</description>
      <pubDate>Tue, 31 Mar 2009 19:58:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/system-call-question/m-p/4391503#M42007</guid>
      <dc:creator>RBrown_1</dc:creator>
      <dc:date>2009-03-31T19:58:47Z</dc:date>
    </item>
    <item>
      <title>Re: system() call question</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/system-call-question/m-p/4391504#M42008</link>
      <description>hi Robert !&lt;BR /&gt;&lt;BR /&gt;passing parameter question was never answered so I thought posting the question here since this is the relevant group .&lt;BR /&gt;&lt;BR /&gt;thanks</description>
      <pubDate>Tue, 31 Mar 2009 20:00:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/system-call-question/m-p/4391504#M42008</guid>
      <dc:creator>SAMI AHMAD</dc:creator>
      <dc:date>2009-03-31T20:00:31Z</dc:date>
    </item>
    <item>
      <title>Re: system() call question</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/system-call-question/m-p/4391505#M42009</link>
      <description>hi Robert ! &lt;BR /&gt;I went back and looked at my post  and here is what I wrote "&lt;BR /&gt;I fixed the issue as follows :&lt;BR /&gt;&lt;BR /&gt;char *cmd = "mcr sys$system:tcpip$snmp_trapsnd.exe 0.0 local 0 0 0 -h 10.100.18.245 -v2c 1.3.6.1.6.3.1.1.4.1.0 \"D\" \"&amp;lt;&lt;PARAMETER here=""&gt; \"";&lt;BR /&gt;&lt;BR /&gt;now my second problem ... i need to pass the message part as parameter .. how can I do this ? "&lt;BR /&gt;&lt;BR /&gt;I didnt get any reply to this question ..where do you see the parameter passing way someone told me .. please point me to it.&lt;BR /&gt;&lt;BR /&gt;thanks&lt;/PARAMETER&gt;</description>
      <pubDate>Tue, 31 Mar 2009 20:07:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/system-call-question/m-p/4391505#M42009</guid>
      <dc:creator>SAMI AHMAD</dc:creator>
      <dc:date>2009-03-31T20:07:14Z</dc:date>
    </item>
    <item>
      <title>Re: system() call question</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/system-call-question/m-p/4391506#M42010</link>
      <description>Go back and reread Steven's post in your previous thread "help in C".  Steven's post begins "Boy, this is painful to watch".&lt;BR /&gt;&lt;BR /&gt;Here are the important things to note:&lt;BR /&gt;&lt;BR /&gt;1. The arguments argc and argv to the main function give you access to parameters on the command line.&lt;BR /&gt;&lt;BR /&gt;2. Do not initialize cmd in your char statement as you insist on doing, just allocate space.&lt;BR /&gt;&lt;BR /&gt;3. Use the sprintf function to load text into the cmd array that you previously allocated.  The format is very similar to the printf statement, and those devious unix people included the letters "print" in the name, BUT IT DOES NOT PRINT ANYTHING, IT JUST PUTS TEXT INTO THE CMD ARRAY.&lt;BR /&gt;&lt;BR /&gt;4. Use the debugger to see what happens to cmd before you pass it to the system() function.&lt;BR /&gt;&lt;BR /&gt;Before Steven gave you a working example, several other answers in the same thread gave you all the information you needed make your own working example.</description>
      <pubDate>Tue, 31 Mar 2009 20:57:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/system-call-question/m-p/4391506#M42010</guid>
      <dc:creator>RBrown_1</dc:creator>
      <dc:date>2009-03-31T20:57:06Z</dc:date>
    </item>
    <item>
      <title>Re: system() call question</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/system-call-question/m-p/4391507#M42011</link>
      <description>Sami, do you want us to provide you with help with your OpenVMS and C programming questions and to help you learn the environment, or do you want us to give you a finished solution specifically tailored for your homework or for your specific business requirements?    These two are not the same, and I'm presuming you're looking for help in learning here.&lt;BR /&gt;&lt;BR /&gt;Here is an example of some C code that performs:&lt;BR /&gt;&lt;BR /&gt;- system()&lt;BR /&gt;- sprintf()&lt;BR /&gt;- a DCL command&lt;BR /&gt;- C argument processing&lt;BR /&gt;&lt;BR /&gt;It's extremely close to what you're asking for, but it's not an exact answer.&lt;BR /&gt;&lt;BR /&gt;$ cc z&lt;BR /&gt;$ link z&lt;BR /&gt;$ z:==$sys$login:z&lt;BR /&gt;$ z USER&lt;BR /&gt;      OpenVMS User Processes at 31-MAR-2009 17:04:44.44&lt;BR /&gt;    Total number of users = ....&lt;BR /&gt;&lt;BR /&gt;$ z TIME  &lt;BR /&gt;  31-MAR-2009 17:04:55&lt;BR /&gt;$ type z.c&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;#include &lt;STDLIB.H&gt;&lt;BR /&gt;main( int argc, char **argv ) {&lt;BR /&gt;  char CmdBuffer[512];&lt;BR /&gt;  sprintf( CmdBuffer, "SHOW %s", argv[1] );&lt;BR /&gt;  system( CmdBuffer );&lt;BR /&gt;  return 1;&lt;BR /&gt;}&lt;BR /&gt;$&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I've posted up a very large C source code example (zip archive) at the HoffmanLabs site; the newuser source code package uses lib$spawn and argument processing and RMS and a whole lot more.  Here are the current bits.  A BSD-style license is in place.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://64.223.189.234/node/1260" target="_blank"&gt;http://64.223.189.234/node/1260&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;And FWIW, an update to this source code is underway.  The new stuff uses argc and argv and getopt and various other features of OpenVMS.  If you're interested in a preliminary copy, contact me offline.&lt;BR /&gt;&lt;BR /&gt;&lt;/STDLIB.H&gt;&lt;/STDIO.H&gt;</description>
      <pubDate>Tue, 31 Mar 2009 21:16:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/system-call-question/m-p/4391507#M42011</guid>
      <dc:creator>Hoff</dc:creator>
      <dc:date>2009-03-31T21:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: system() call question</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/system-call-question/m-p/4391508#M42012</link>
      <description>ofcoure i dont want solutions , iam here to learn and thats how I solved the snmp trap solution myself using libspawn in C , with ofcourse yours n everyone's advise.&lt;BR /&gt;thanks for your help</description>
      <pubDate>Tue, 31 Mar 2009 21:24:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/system-call-question/m-p/4391508#M42012</guid>
      <dc:creator>SAMI AHMAD</dc:creator>
      <dc:date>2009-03-31T21:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: system() call question</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/system-call-question/m-p/4391509#M42013</link>
      <description>btw I have no assignments from my boss I am learning openVMS for my own. as a profession iam a DBA :)</description>
      <pubDate>Tue, 31 Mar 2009 21:27:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/system-call-question/m-p/4391509#M42013</guid>
      <dc:creator>SAMI AHMAD</dc:creator>
      <dc:date>2009-03-31T21:27:57Z</dc:date>
    </item>
    <item>
      <title>Re: system() call question</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/system-call-question/m-p/4391510#M42014</link>
      <description>Repost: ITRC tipped over.&lt;BR /&gt;&lt;BR /&gt;A slightly updated version of the C code posted above is now posted at:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://labs.hoffmanlabs.com/node/1261" target="_blank"&gt;http://labs.hoffmanlabs.com/node/1261&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;If you're interested in learning C on your own, then one of the options is to borrow or to purchase the K&amp;amp;R C book Second Edition, or a similar book on the language.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://en.wikipedia.org/wiki/The_C_Programming_Language_(book)" target="_blank"&gt;http://en.wikipedia.org/wiki/The_C_Programming_Language_(book)&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;And also look at the C programming shelf available within the HP OpenVMS manuals.  There are a gazillion C examples on the OpenVMS Freeware distributions, as well.&lt;BR /&gt;</description>
      <pubDate>Tue, 31 Mar 2009 21:49:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/system-call-question/m-p/4391510#M42014</guid>
      <dc:creator>Hoff</dc:creator>
      <dc:date>2009-03-31T21:49:45Z</dc:date>
    </item>
    <item>
      <title>Re: system() call question</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/system-call-question/m-p/4391511#M42015</link>
      <description>I solved this problem by concatanating strings together with the arguments as follows:&lt;BR /&gt;&lt;BR /&gt;#include &lt;STDIO.H&gt; &lt;BR /&gt;#include &lt;STDLIB.H&gt; &lt;BR /&gt;#include &lt;STRING.H&gt;&lt;BR /&gt;&lt;BR /&gt;#define size 512&lt;BR /&gt;static char cmdbuffer[size];&lt;BR /&gt; &lt;BR /&gt;main(int argc, char **argv ) &lt;BR /&gt;{ &lt;BR /&gt;   int i; &lt;BR /&gt;   int sts;&lt;BR /&gt;  char *cmd = "mcr sys$system:tcpip$snmp_trapsnd.exe 0.0 local 0 0 0 -h 10.100.18.245 -v2c  1.3.6.1.6.3.1.1.4.1.0 \"D\"";&lt;BR /&gt;   &lt;BR /&gt;/* argv[0] is program name  */ &lt;BR /&gt; &lt;BR /&gt;    strncat (cmdbuffer, cmd,size);&lt;BR /&gt;    strncat (cmdbuffer, "  \"",size);&lt;BR /&gt;    strncat (cmdbuffer, argv[1],size);&lt;BR /&gt;    strncat (cmdbuffer,"\"",size);&lt;BR /&gt;    printf ("%s\n",cmdbuffer);&lt;BR /&gt;    sts = system(cmdbuffer); &lt;BR /&gt;   printf( " sts = %%x%08x.\n", sts);&lt;BR /&gt;} &lt;BR /&gt;&lt;BR /&gt;$ commarg "two parameters"&lt;BR /&gt;mcr sys$system:tcpip$snmp_trapsnd.exe 0.0 local 0 0 0 -h 10.100.18.245 -v2c  1.3.6.1.6.3.1.1.4.1.0 "D"  "two parameters"&lt;BR /&gt; sts = %x00000001.&lt;BR /&gt;&lt;BR /&gt;&lt;/STRING.H&gt;&lt;/STDLIB.H&gt;&lt;/STDIO.H&gt;</description>
      <pubDate>Wed, 01 Apr 2009 23:20:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/system-call-question/m-p/4391511#M42015</guid>
      <dc:creator>SAMI AHMAD</dc:creator>
      <dc:date>2009-04-01T23:20:34Z</dc:date>
    </item>
    <item>
      <title>Re: system() call question</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/system-call-question/m-p/4391512#M42016</link>
      <description>Fine, You now know that there are several ways in C to accomplish the same result.&lt;BR /&gt;&lt;BR /&gt;Last week in another thread You learned already how to replace the series of strncat by a single sprintf :-)</description>
      <pubDate>Thu, 02 Apr 2009 06:33:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/system-call-question/m-p/4391512#M42016</guid>
      <dc:creator>Joseph Huber_1</dc:creator>
      <dc:date>2009-04-02T06:33:16Z</dc:date>
    </item>
    <item>
      <title>Re: system() call question</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/system-call-question/m-p/4391513#M42017</link>
      <description>Here's a different answer to the homework.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#include &lt;STDIO.H&gt; &lt;BR /&gt;#include &lt;STDLIB.H&gt; &lt;BR /&gt;#include &lt;STRING.H&gt;&lt;BR /&gt;&lt;BR /&gt;#define CMDBUFFERSIZE 512&lt;BR /&gt;static char cmdbuffer[CMDBUFFERSIZE+1];&lt;BR /&gt;&lt;BR /&gt;main(int argc, char **argv ) &lt;BR /&gt;{ &lt;BR /&gt;int sts;&lt;BR /&gt;char *cmd = "mcr tcpip$snmp_trapsnd.exe 0.0 local 0 0 0 -h 10.100.18.245 -v2c 1.3.6.1.6.3.1.1.4.1.0 \"D\" \"%.*s\"";&lt;BR /&gt;sprintf( cmdbuffer, cmd, CMDBUFFERSIZE, argv[1] );&lt;BR /&gt;system( cmdbuffer );&lt;BR /&gt;}&lt;BR /&gt;&lt;/STRING.H&gt;&lt;/STDLIB.H&gt;&lt;/STDIO.H&gt;</description>
      <pubDate>Thu, 02 Apr 2009 14:32:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/system-call-question/m-p/4391513#M42017</guid>
      <dc:creator>Hoff</dc:creator>
      <dc:date>2009-04-02T14:32:02Z</dc:date>
    </item>
  </channel>
</rss>

