<?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: Wildcard matching inside a program in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/wildcard-matching-inside-a-program/m-p/3851861#M98108</link>
    <description>Oh (and again making the assumption that this is related to directories then you also have the ability to do this directly in a C program without fork()ing a process as popen() would do. Open the directory with opendir(); read each entry using readdir(); use the fnmatch() function to do the expression matching, and close the directory with closedir().&lt;BR /&gt;&lt;BR /&gt;Man opendir,readdir,closedir,fnmatch for details.&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Mon, 28 Aug 2006 17:34:19 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2006-08-28T17:34:19Z</dc:date>
    <item>
      <title>Wildcard matching inside a program</title>
      <link>https://community.hpe.com/t5/operating-system-linux/wildcard-matching-inside-a-program/m-p/3851859#M98106</link>
      <description>Hi experts:&lt;BR /&gt;&lt;BR /&gt;How do I do something like match "*.dat" from inside a C program?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Greg</description>
      <pubDate>Mon, 28 Aug 2006 17:18:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/wildcard-matching-inside-a-program/m-p/3851859#M98106</guid>
      <dc:creator>Greg White</dc:creator>
      <dc:date>2006-08-28T17:18:50Z</dc:date>
    </item>
    <item>
      <title>Re: Wildcard matching inside a program</title>
      <link>https://community.hpe.com/t5/operating-system-linux/wildcard-matching-inside-a-program/m-p/3851860#M98107</link>
      <description>Sometimes it's hard to beat the simple approach (I assume that this is a directory listing):&lt;BR /&gt;&lt;BR /&gt;FILE *p = NULL;&lt;BR /&gt;int cc = 0;&lt;BR /&gt;&lt;BR /&gt;p = popen("ls *.dat","r");&lt;BR /&gt;if (p != NULL)&lt;BR /&gt;  {&lt;BR /&gt;    char s[512],*q = NULL;&lt;BR /&gt;    q = fgets(s,sizeof(s),p);&lt;BR /&gt;    while (q != NULL)&lt;BR /&gt;      {&lt;BR /&gt;        printf("%s\n",q);&lt;BR /&gt;        q = fgets(s,sizeof(s),p);&lt;BR /&gt;      }&lt;BR /&gt;    cc = pclose(p);&lt;BR /&gt;  }&lt;BR /&gt; &lt;BR /&gt;</description>
      <pubDate>Mon, 28 Aug 2006 17:30:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/wildcard-matching-inside-a-program/m-p/3851860#M98107</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2006-08-28T17:30:45Z</dc:date>
    </item>
    <item>
      <title>Re: Wildcard matching inside a program</title>
      <link>https://community.hpe.com/t5/operating-system-linux/wildcard-matching-inside-a-program/m-p/3851861#M98108</link>
      <description>Oh (and again making the assumption that this is related to directories then you also have the ability to do this directly in a C program without fork()ing a process as popen() would do. Open the directory with opendir(); read each entry using readdir(); use the fnmatch() function to do the expression matching, and close the directory with closedir().&lt;BR /&gt;&lt;BR /&gt;Man opendir,readdir,closedir,fnmatch for details.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Aug 2006 17:34:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/wildcard-matching-inside-a-program/m-p/3851861#M98108</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2006-08-28T17:34:19Z</dc:date>
    </item>
    <item>
      <title>Re: Wildcard matching inside a program</title>
      <link>https://community.hpe.com/t5/operating-system-linux/wildcard-matching-inside-a-program/m-p/3851862#M98109</link>
      <description>and as a Plan C (and this will apply to any pattern matching, not just filenames): Use regcmp() and regex(). Man regcmp and regex for details. These give you are the power of regular expression matching from within your C/C++ code.&lt;BR /&gt;&lt;BR /&gt;No points for this please. I should have added this earlier.&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Aug 2006 17:37:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/wildcard-matching-inside-a-program/m-p/3851862#M98109</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2006-08-28T17:37:50Z</dc:date>
    </item>
    <item>
      <title>Re: Wildcard matching inside a program</title>
      <link>https://community.hpe.com/t5/operating-system-linux/wildcard-matching-inside-a-program/m-p/3851863#M98110</link>
      <description>If you are doing something as simple as *.dat, you could look at the last 4 chars of the string for ".dat".&lt;BR /&gt;Otherwise, what Clay said.</description>
      <pubDate>Mon, 28 Aug 2006 18:24:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/wildcard-matching-inside-a-program/m-p/3851863#M98110</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2006-08-28T18:24:16Z</dc:date>
    </item>
  </channel>
</rss>

