<?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: help in C in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386877#M41928</link>
    <description>&lt;!--!*#--&gt;Boy, this is painful to watch.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;  Sami, do You mean something like this ?&lt;BR /&gt;&lt;BR /&gt;Probably more like this:&lt;BR /&gt;&lt;BR /&gt;alp $ type snmp2.c&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;#include &lt;STDLIB.H&gt;&lt;BR /&gt;&lt;BR /&gt;int main( int argc, char **argv)&lt;BR /&gt;{&lt;BR /&gt;    int sts;&lt;BR /&gt;    char cmd[ 1024];&lt;BR /&gt;&lt;BR /&gt;    sprintf( cmd, "mcr tcpip$snmp_trapsnd.exe\&lt;BR /&gt; 1.3.6.1.6.3.1.1.4.1.0 local 0 0 0 -v2c -h 10.100.10.112 \"D\" \"%s\"",&lt;BR /&gt;     argv[ 1]);&lt;BR /&gt;&lt;BR /&gt;    printf( " cmd: &amp;gt;%s&amp;lt;.\n", cmd);&lt;BR /&gt;    sts = system( cmd);&lt;BR /&gt;&lt;BR /&gt;    printf( " sts = %%x%08x.\n", sts);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;alp $ cc snmp2&lt;BR /&gt;alp $ link snmp2&lt;BR /&gt;alp $ mcr []snmp2 "my message text"&lt;BR /&gt; cmd: &amp;gt;mcr tcpip$snmp_trapsnd.exe 1.3.6.1.6.3.1.1.4.1.0 local 0 0 0 -v2c -h 10.1&lt;BR /&gt;00.10.112 "D" "my message text"&amp;lt;.&lt;BR /&gt;Invalid variable name OID syntax: D&lt;BR /&gt;Invalid variable list.&lt;BR /&gt;#snmp_trapsnd enterprise agent-address generic specific timeticks&lt;BR /&gt;[-v version] [-c community] [-h host] [-p port] [-tcp] {variable [type value]}&lt;BR /&gt; sts = %x00000001.&lt;BR /&gt;alp $&lt;BR /&gt;&lt;BR /&gt;Looks as if the command itself may need a&lt;BR /&gt;little work.&lt;BR /&gt;&lt;BR /&gt;The 'D' must be '"D"' to keep it upper-case&lt;BR /&gt;when snmp_trapsnd sees it.&lt;BR /&gt;&lt;BR /&gt;Note that no one is checking to see if you&lt;BR /&gt;really have a command-line argument (argc &amp;gt;&lt;BR /&gt;1), so it'll behave badly if you don't&lt;BR /&gt;specify one.&lt;/STDLIB.H&gt;&lt;/STDIO.H&gt;</description>
    <pubDate>Tue, 24 Mar 2009 18:38:09 GMT</pubDate>
    <dc:creator>Steven Schweda</dc:creator>
    <dc:date>2009-03-24T18:38:09Z</dc:date>
    <item>
      <title>help in C</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386860#M41911</link>
      <description>can someone give me small example of a C program taking a string input and printing it?&lt;BR /&gt;&lt;BR /&gt;thanks</description>
      <pubDate>Tue, 24 Mar 2009 15:06:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386860#M41911</guid>
      <dc:creator>SAMI AHMAD</dc:creator>
      <dc:date>2009-03-24T15:06:18Z</dc:date>
    </item>
    <item>
      <title>Re: help in C</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386861#M41912</link>
      <description>Sure.  See attached.&lt;BR /&gt;&lt;BR /&gt;$ cc x&lt;BR /&gt;$ link x&lt;BR /&gt;$ run x&lt;BR /&gt;hi&lt;BR /&gt;hi&lt;BR /&gt;$ type x.c&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;main()&lt;BR /&gt; {&lt;BR /&gt; char foo[255];&lt;BR /&gt; gets( foo );&lt;BR /&gt; printf( foo );&lt;BR /&gt; return 0;&lt;BR /&gt; }&lt;BR /&gt;$&lt;BR /&gt;&lt;BR /&gt;The above code runs and does exactly what you've asked for, but it's not particularly secure nor entirely reliable.  The gets call has vulnerabilities.&lt;BR /&gt;&lt;BR /&gt;I've posted a far larger example C program (that does this prompting, and a whole lot more) in the newuser code in the zip archive available available via:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://64.223.189.234/node/1135" target="_blank"&gt;http://64.223.189.234/node/1135&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;The OpenVMS C manuals and the OpenVMS programming concepts manuals (all of which are required reading here) are available at:&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;The C manuals and the Programming Concepts manual introduce you to the language and to programming C on OpenVMS.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/STDIO.H&gt;</description>
      <pubDate>Tue, 24 Mar 2009 15:40:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386861#M41912</guid>
      <dc:creator>Hoff</dc:creator>
      <dc:date>2009-03-24T15:40:07Z</dc:date>
    </item>
    <item>
      <title>Re: help in C</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386862#M41913</link>
      <description>hi Hoff !&lt;BR /&gt;I am sorry i think i explained it wrong, i dont want to input a string from command line but i want to be able to pass an argument to a procedure say  x("test string")&lt;BR /&gt;and the program should print the string ? &lt;BR /&gt;&lt;BR /&gt;thanks for help</description>
      <pubDate>Tue, 24 Mar 2009 15:45:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386862#M41913</guid>
      <dc:creator>SAMI AHMAD</dc:creator>
      <dc:date>2009-03-24T15:45:00Z</dc:date>
    </item>
    <item>
      <title>Re: help in C</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386863#M41914</link>
      <description>$ create demo.c&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;void main ()&lt;BR /&gt;{&lt;BR /&gt;  while (putchar (getchar ()) != EOF)&lt;BR /&gt;    {}&lt;BR /&gt;}&lt;BR /&gt;^Z&lt;BR /&gt;$ cc demo&lt;BR /&gt;$ link demo&lt;BR /&gt;$ run demo&lt;BR /&gt;the quick brown fox jumps over the lazy dog!&lt;BR /&gt;the quick brown fox jumps over the laxy dog!&lt;BR /&gt;^Z&lt;BR /&gt;&lt;BR /&gt;Figuring out how to get rid of the y-umlaut at the end is left as an exercise.&lt;BR /&gt;&lt;/STDIO.H&gt;</description>
      <pubDate>Tue, 24 Mar 2009 15:49:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386863#M41914</guid>
      <dc:creator>RBrown_1</dc:creator>
      <dc:date>2009-03-24T15:49:49Z</dc:date>
    </item>
    <item>
      <title>Re: help in C</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386864#M41915</link>
      <description>ok here is what I am trying to do , below is my program and I want to pass 'msg' as parameter not on command line .. &lt;BR /&gt;&lt;BR /&gt;SUNNY2$ type snmp.c  &lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;#include &lt;STDLIB.H&gt;&lt;BR /&gt;&lt;BR /&gt;int main( char *msg)&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\" \"msg\"";&lt;BR /&gt;&lt;BR /&gt;    printf( " cmd: &amp;gt;%s&amp;lt;.\n", cmd);&lt;BR /&gt;    sts = system( cmd);&lt;BR /&gt;&lt;BR /&gt;    printf( " sts = %%x%08x.\n", sts);&lt;BR /&gt;}&lt;/STDLIB.H&gt;&lt;/STDIO.H&gt;</description>
      <pubDate>Tue, 24 Mar 2009 15:54:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386864#M41915</guid>
      <dc:creator>SAMI AHMAD</dc:creator>
      <dc:date>2009-03-24T15:54:52Z</dc:date>
    </item>
    <item>
      <title>Re: help in C</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386865#M41916</link>
      <description>The C call you want here is sprintf().&lt;BR /&gt;</description>
      <pubDate>Tue, 24 Mar 2009 16:02:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386865#M41916</guid>
      <dc:creator>Hoff</dc:creator>
      <dc:date>2009-03-24T16:02:30Z</dc:date>
    </item>
    <item>
      <title>Re: help in C</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386866#M41917</link>
      <description>We have a problem with terminology here.  Typically, "command line" means those lines in my and Hoff's replies like:&lt;BR /&gt;&lt;BR /&gt;$ cc demo&lt;BR /&gt;$ link demo&lt;BR /&gt;$ run demo&lt;BR /&gt;&lt;BR /&gt;Neither my nor Hoff's programs accepted input from the command line in that sense.&lt;BR /&gt;&lt;BR /&gt;You say you want to "pass an argument to a procedure".&lt;BR /&gt;&lt;BR /&gt;Do you mean like a function call?  For example the printf function call:&lt;BR /&gt;&lt;BR /&gt;  printf ("test string\n");&lt;BR /&gt;&lt;BR /&gt;Or you want to write a function that accepts a string argument and sends it to printf?&lt;BR /&gt;&lt;BR /&gt;Or do you want to write a program that prints strings from the command line as in&lt;BR /&gt;&lt;BR /&gt;$ demo "test string"&lt;BR /&gt;test string&lt;BR /&gt;&lt;BR /&gt;?&lt;BR /&gt;&lt;BR /&gt;In the latter case, refer to the DECC Language Reference Manual "Passing Arguments to the main Function", which is section 5.6.3 in the very old copy that I have.&lt;BR /&gt;&lt;BR /&gt;You can find the DECC documentation in the usual places on the HP VMS documentation web site.&lt;BR /&gt;</description>
      <pubDate>Tue, 24 Mar 2009 16:04:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386866#M41917</guid>
      <dc:creator>RBrown_1</dc:creator>
      <dc:date>2009-03-24T16:04:21Z</dc:date>
    </item>
    <item>
      <title>Re: help in C</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386867#M41918</link>
      <description>the above program i gave is a perfectly working program ,but it has hard code string called 'msg' that it sends as snmp trap, all i want to do is to be able to replace 'msg' with a dynamic value ,&lt;BR /&gt;so from command prompt i should be able to do this &lt;BR /&gt;$sndsnmp :== $sys$login:snmp.exe&lt;BR /&gt;$sndsnmp "test msg"&lt;BR /&gt;$sndsnmp "another test" &lt;BR /&gt;&lt;BR /&gt;run snmp.exe "test msg"  and the prog should replace the 'msg' value in the program with "test msg" , do you know what iam saying ? &lt;BR /&gt;let me know otherwise i will explain further</description>
      <pubDate>Tue, 24 Mar 2009 16:18:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386867#M41918</guid>
      <dc:creator>SAMI AHMAD</dc:creator>
      <dc:date>2009-03-24T16:18:44Z</dc:date>
    </item>
    <item>
      <title>Re: help in C</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386868#M41919</link>
      <description>Yup.  You need to read section 5.6.3.&lt;BR /&gt;&lt;BR /&gt;Probably your solution will include a statement something like this:&lt;BR /&gt;&lt;BR /&gt;sprintf (cmd, "long string prefix %s", argv[1]);&lt;BR /&gt;</description>
      <pubDate>Tue, 24 Mar 2009 16:34:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386868#M41919</guid>
      <dc:creator>RBrown_1</dc:creator>
      <dc:date>2009-03-24T16:34:32Z</dc:date>
    </item>
    <item>
      <title>Re: help in C</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386869#M41920</link>
      <description>hi Brown !&lt;BR /&gt;&lt;BR /&gt;let me explain in a better way , I think what i need is very simple . &lt;BR /&gt;&lt;BR /&gt;this is my working program now :&lt;BR /&gt;&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;#include &lt;STDLIB.H&gt;&lt;BR /&gt;&lt;BR /&gt;int main()&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\" \"msg\"";&lt;BR /&gt;&lt;BR /&gt;    printf( " cmd: &amp;gt;%s&amp;lt;.\n", cmd);&lt;BR /&gt;    sts = system( cmd);&lt;BR /&gt;&lt;BR /&gt;    printf( " sts = %%x%08x.\n", sts);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;I run it like this :&lt;BR /&gt;&lt;BR /&gt;SNDSNMP == "$SYS$LOGIN:SNMP.EXE"&lt;BR /&gt;SUNNY2$ sndsnmp &lt;BR /&gt; cmd: &amp;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" "msg"&amp;lt;.&lt;BR /&gt; sts = %x00000001.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;you see above its  constructing a command with hard coded "msg" .&lt;BR /&gt;i want to be able to do this &lt;BR /&gt;&lt;BR /&gt;$sndsnmp "test msg"&lt;BR /&gt;and it should construct the command &lt;BR /&gt;&lt;BR /&gt;cmd: &amp;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" "test msg"&amp;lt;.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/STDLIB.H&gt;&lt;/STDIO.H&gt;</description>
      <pubDate>Tue, 24 Mar 2009 16:40:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386869#M41920</guid>
      <dc:creator>SAMI AHMAD</dc:creator>
      <dc:date>2009-03-24T16:40:45Z</dc:date>
    </item>
    <item>
      <title>Re: help in C</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386870#M41921</link>
      <description>one thing more ..is iam not intersted in printf..that is just for diagnosis. my need is to construct this string dynamically &lt;BR /&gt;(the part marked with ^^^)&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\" \"msg\"";&lt;BR /&gt;                              ^^^  &lt;BR /&gt;</description>
      <pubDate>Tue, 24 Mar 2009 16:44:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386870#M41921</guid>
      <dc:creator>SAMI AHMAD</dc:creator>
      <dc:date>2009-03-24T16:44:06Z</dc:date>
    </item>
    <item>
      <title>Re: help in C</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386871#M41922</link>
      <description>to make things even simpler &lt;BR /&gt;&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;#include &lt;STDLIB.H&gt;&lt;BR /&gt;&lt;BR /&gt;main()&lt;BR /&gt;{&lt;BR /&gt;  char *cmd ="write sys$output msg";&lt;BR /&gt;        printf( " cmd: &amp;gt;%s&amp;lt;.\n", cmd);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;SUNNY2$ xx :== $sys$login:x.exe&lt;BR /&gt;SUNNY2$ xx &lt;BR /&gt; cmd: &amp;gt;write sys$output msg&amp;lt;.&lt;BR /&gt;&lt;BR /&gt;I want to be able to do this &lt;BR /&gt;&lt;BR /&gt;main( argument)&lt;BR /&gt;{&lt;BR /&gt;   char *cmd ="write sys$output &lt;PASSED parameter=""&gt;&lt;/PASSED&gt;   printf( " cmd: &amp;gt;%s&amp;lt;.\n", cmd);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;SUNNY2$ xx :== $sys$login:x.exe&lt;BR /&gt;SUNNY2$ xx "test msg"&lt;BR /&gt; cmd: &amp;gt;write sys$output test msg&amp;lt;.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/STDLIB.H&gt;&lt;/STDIO.H&gt;</description>
      <pubDate>Tue, 24 Mar 2009 17:03:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386871#M41922</guid>
      <dc:creator>SAMI AHMAD</dc:creator>
      <dc:date>2009-03-24T17:03:45Z</dc:date>
    </item>
    <item>
      <title>Re: help in C</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386872#M41923</link>
      <description>ok I found the solution : &lt;BR /&gt;&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;#include &lt;STDLIB.H&gt;&lt;BR /&gt;&lt;BR /&gt;int main(int argc, char *argv[]) &lt;BR /&gt;{&lt;BR /&gt;    int sts;&lt;BR /&gt;    char msg;&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\" \"*msg\"";&lt;BR /&gt;&lt;BR /&gt;     printf("program: %s\n",argv[1]);&lt;BR /&gt; /*    printf( " cmd: &amp;gt;%s&amp;lt;.\n", cmd);    */&lt;BR /&gt;    sts = system( cmd);&lt;BR /&gt;&lt;BR /&gt;    printf( " sts = %%x%08x.\n", sts);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;SUNNY2$ sndsnmp testing&lt;BR /&gt;program: testing&lt;BR /&gt; sts = %x00000001.&lt;BR /&gt;&lt;BR /&gt;but I cant replace the 'msg' with the argument passed .. any ideas ?&lt;/STDLIB.H&gt;&lt;/STDIO.H&gt;</description>
      <pubDate>Tue, 24 Mar 2009 17:31:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386872#M41923</guid>
      <dc:creator>SAMI AHMAD</dc:creator>
      <dc:date>2009-03-24T17:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: help in C</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386873#M41924</link>
      <description>Use sprintf().  That's the formatted string conversion routine; it looks and works very much like the C printf() call, but dumps the results into a string buffer.  Your command-level string would be a parameter passed into the sprintf() here.</description>
      <pubDate>Tue, 24 Mar 2009 17:42:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386873#M41924</guid>
      <dc:creator>Hoff</dc:creator>
      <dc:date>2009-03-24T17:42:56Z</dc:date>
    </item>
    <item>
      <title>Re: help in C</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386874#M41925</link>
      <description>but Hoff I dont need to print anything i need to assign  like below &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\" \"*msg\"";&lt;BR /&gt;                               ^^^^&lt;BR /&gt;&lt;BR /&gt;how can i do this by sprintf ?</description>
      <pubDate>Tue, 24 Mar 2009 17:45:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386874#M41925</guid>
      <dc:creator>SAMI AHMAD</dc:creator>
      <dc:date>2009-03-24T17:45:11Z</dc:date>
    </item>
    <item>
      <title>Re: help in C</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386875#M41926</link>
      <description>&lt;A href="http://h71000.www7.hp.com/doc/83final/5763/5763pro_060.html#sprintf_routine" target="_blank"&gt;http://h71000.www7.hp.com/doc/83final/5763/5763pro_060.html#sprintf_routine&lt;/A&gt;</description>
      <pubDate>Tue, 24 Mar 2009 18:05:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386875#M41926</guid>
      <dc:creator>RBrown_1</dc:creator>
      <dc:date>2009-03-24T18:05:23Z</dc:date>
    </item>
    <item>
      <title>Re: help in C</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386876#M41927</link>
      <description>Sami, do You mean something like this ?&lt;BR /&gt;&lt;BR /&gt;tsprintf.c:&lt;BR /&gt;&lt;BR /&gt;#include stdio&lt;BR /&gt;int main(int argc, char *argv[]) {&lt;BR /&gt;  char cmd[256];&lt;BR /&gt;  sprintf(cmd,"mcr sys$system:tcpip$snmp_trapsnd.exe"\&lt;BR /&gt;" 0.0 local 0 0 0 -h %s v2c"\&lt;BR /&gt;"1.3.6.1.6.3.1.1.4.1.0 \"D\" \"*msg\"",argv[1]);&lt;BR /&gt;&lt;BR /&gt;  printf(" %s\n",cmd); /show result*/&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Test the program:&lt;BR /&gt;$ mcr []tsprintf 10.1.222.1&lt;BR /&gt; mcr sys$system:tcpip$snmp_trapsnd.exe 0.0 local 0 0 0 -h 10.1.222.1 v2c1.3.6.1.&lt;BR /&gt;6.3.1.1.4.1.0 "D" "*msg"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 24 Mar 2009 18:10:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386876#M41927</guid>
      <dc:creator>Joseph Huber_1</dc:creator>
      <dc:date>2009-03-24T18:10:59Z</dc:date>
    </item>
    <item>
      <title>Re: help in C</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386877#M41928</link>
      <description>&lt;!--!*#--&gt;Boy, this is painful to watch.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;  Sami, do You mean something like this ?&lt;BR /&gt;&lt;BR /&gt;Probably more like this:&lt;BR /&gt;&lt;BR /&gt;alp $ type snmp2.c&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;#include &lt;STDLIB.H&gt;&lt;BR /&gt;&lt;BR /&gt;int main( int argc, char **argv)&lt;BR /&gt;{&lt;BR /&gt;    int sts;&lt;BR /&gt;    char cmd[ 1024];&lt;BR /&gt;&lt;BR /&gt;    sprintf( cmd, "mcr tcpip$snmp_trapsnd.exe\&lt;BR /&gt; 1.3.6.1.6.3.1.1.4.1.0 local 0 0 0 -v2c -h 10.100.10.112 \"D\" \"%s\"",&lt;BR /&gt;     argv[ 1]);&lt;BR /&gt;&lt;BR /&gt;    printf( " cmd: &amp;gt;%s&amp;lt;.\n", cmd);&lt;BR /&gt;    sts = system( cmd);&lt;BR /&gt;&lt;BR /&gt;    printf( " sts = %%x%08x.\n", sts);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;alp $ cc snmp2&lt;BR /&gt;alp $ link snmp2&lt;BR /&gt;alp $ mcr []snmp2 "my message text"&lt;BR /&gt; cmd: &amp;gt;mcr tcpip$snmp_trapsnd.exe 1.3.6.1.6.3.1.1.4.1.0 local 0 0 0 -v2c -h 10.1&lt;BR /&gt;00.10.112 "D" "my message text"&amp;lt;.&lt;BR /&gt;Invalid variable name OID syntax: D&lt;BR /&gt;Invalid variable list.&lt;BR /&gt;#snmp_trapsnd enterprise agent-address generic specific timeticks&lt;BR /&gt;[-v version] [-c community] [-h host] [-p port] [-tcp] {variable [type value]}&lt;BR /&gt; sts = %x00000001.&lt;BR /&gt;alp $&lt;BR /&gt;&lt;BR /&gt;Looks as if the command itself may need a&lt;BR /&gt;little work.&lt;BR /&gt;&lt;BR /&gt;The 'D' must be '"D"' to keep it upper-case&lt;BR /&gt;when snmp_trapsnd sees it.&lt;BR /&gt;&lt;BR /&gt;Note that no one is checking to see if you&lt;BR /&gt;really have a command-line argument (argc &amp;gt;&lt;BR /&gt;1), so it'll behave badly if you don't&lt;BR /&gt;specify one.&lt;/STDLIB.H&gt;&lt;/STDIO.H&gt;</description>
      <pubDate>Tue, 24 Mar 2009 18:38:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386877#M41928</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2009-03-24T18:38:09Z</dc:date>
    </item>
    <item>
      <title>Re: help in C</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386878#M41929</link>
      <description>I know nothing about the snmp... command syntax, the question was how to use sprintf to replace a part by commandline arguments, and Sami&lt;BR /&gt;marked 10.100.18.245 by ^^^^, so I assumed this IP address should be the variable argument.</description>
      <pubDate>Tue, 24 Mar 2009 19:21:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386878#M41929</guid>
      <dc:creator>Joseph Huber_1</dc:creator>
      <dc:date>2009-03-24T19:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: help in C</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386879#M41930</link>
      <description>ITRC forum wrapping makes it appear that it is pointing to ip address, but it is really pointing at the "char".&lt;BR /&gt;&lt;BR /&gt;Cut and paste into (for example notepad), and you will see.&lt;BR /&gt;&lt;BR /&gt;But what does this whole topic have to do with VMS?&lt;BR /&gt;&lt;BR /&gt;Sami, if you need to learn C, this isn't the place to learn.&lt;BR /&gt;&lt;BR /&gt;See Hoff's response to your question about snmp traps.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1325393" target="_blank"&gt;http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1325393&lt;/A&gt;</description>
      <pubDate>Wed, 25 Mar 2009 04:06:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/help-in-c/m-p/4386879#M41930</guid>
      <dc:creator>Jon Pinkley</dc:creator>
      <dc:date>2009-03-25T04:06:05Z</dc:date>
    </item>
  </channel>
</rss>

