<?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 Help with UNIX 'system' calls in a CPP program... in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-unix-system-calls-in-a-cpp-program/m-p/2560091#M725050</link>
    <description>Do any of you know the best way for me to perform a "system" call in a CPP file and place the output into a char pointer (or string) instead of writing it to the screen?&lt;BR /&gt;&lt;BR /&gt;I need to print the UNIX calls to a XmTextField, rather than to the screen....</description>
    <pubDate>Wed, 01 Aug 2001 15:39:07 GMT</pubDate>
    <dc:creator>Amber_1</dc:creator>
    <dc:date>2001-08-01T15:39:07Z</dc:date>
    <item>
      <title>Help with UNIX 'system' calls in a CPP program...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-unix-system-calls-in-a-cpp-program/m-p/2560091#M725050</link>
      <description>Do any of you know the best way for me to perform a "system" call in a CPP file and place the output into a char pointer (or string) instead of writing it to the screen?&lt;BR /&gt;&lt;BR /&gt;I need to print the UNIX calls to a XmTextField, rather than to the screen....</description>
      <pubDate>Wed, 01 Aug 2001 15:39:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-unix-system-calls-in-a-cpp-program/m-p/2560091#M725050</guid>
      <dc:creator>Amber_1</dc:creator>
      <dc:date>2001-08-01T15:39:07Z</dc:date>
    </item>
    <item>
      <title>Re: Help with UNIX 'system' calls in a CPP program...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-unix-system-calls-in-a-cpp-program/m-p/2560092#M725051</link>
      <description>Hi Amber,&lt;BR /&gt;&lt;BR /&gt;You could easily do it as an extern "C" something like this:&lt;BR /&gt;&lt;BR /&gt;char *one_liner_system(char *s_cmd, int *result)&lt;BR /&gt;{&lt;BR /&gt;  static char buff[512];&lt;BR /&gt;  char *s = NULL,cmd2[1024];&lt;BR /&gt;  FILE *p = NULL;&lt;BR /&gt;&lt;BR /&gt;  buff[0] = '\0';&lt;BR /&gt;  *result = -1;&lt;BR /&gt;  (void) sprintf(cmd2,"%s 2&amp;gt;/dev/null",s_cmd);&lt;BR /&gt;  p = popen(cmd2,"p");&lt;BR /&gt;  if (p != NULL)&lt;BR /&gt;    {&lt;BR /&gt;      s = fgets(buff,(sizeof) buff,p);&lt;BR /&gt;      *result = pclose(p);&lt;BR /&gt;    }&lt;BR /&gt;  return(s)&lt;BR /&gt;}   &lt;BR /&gt;&lt;BR /&gt;The above function will return one line of the system call and set *result to the status of the system call and redirect stderr to /dev/null.&lt;BR /&gt;&lt;BR /&gt;Regards, Clay</description>
      <pubDate>Wed, 01 Aug 2001 17:28:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-unix-system-calls-in-a-cpp-program/m-p/2560092#M725051</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-08-01T17:28:39Z</dc:date>
    </item>
  </channel>
</rss>

