<?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: Using C to check file patten on directory in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/using-c-to-check-file-patten-on-directory/m-p/3824795#M100429</link>
    <description>Yes, possible in plenty, plenty of ways.&lt;BR /&gt;&lt;BR /&gt;As many ways as you care to write a string matching algorithm.</description>
    <pubDate>Mon, 17 Jul 2006 09:21:37 GMT</pubDate>
    <dc:creator>TwoProc</dc:creator>
    <dc:date>2006-07-17T09:21:37Z</dc:date>
    <item>
      <title>Using C to check file patten on directory</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-c-to-check-file-patten-on-directory/m-p/3824793#M100427</link>
      <description>Hi Guys,&lt;BR /&gt;&lt;BR /&gt;  Just wondering is it possible to use C program to check whether files with certain pattern exists on a directory i.e. similar to using "ls pattern*" &lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;Henry</description>
      <pubDate>Mon, 17 Jul 2006 09:13:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-c-to-check-file-patten-on-directory/m-p/3824793#M100427</guid>
      <dc:creator>Henry Chua</dc:creator>
      <dc:date>2006-07-17T09:13:59Z</dc:date>
    </item>
    <item>
      <title>Re: Using C to check file patten on directory</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-c-to-check-file-patten-on-directory/m-p/3824794#M100428</link>
      <description>Of course it is possible. How do you think the ls command ultimately does it? On the other hand, why reinvent the wheel when a:&lt;BR /&gt;File *f;&lt;BR /&gt;f = popen("ls xyz*","r");&lt;BR /&gt;would do the trick for you.&lt;BR /&gt;&lt;BR /&gt;If you really want to do this then you use opendir() to open a directory, readdir() to read each directory entry, and then use the regcomp() and related functions for RE matching. Man regcomp for details.&lt;BR /&gt;</description>
      <pubDate>Mon, 17 Jul 2006 09:21:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-c-to-check-file-patten-on-directory/m-p/3824794#M100428</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2006-07-17T09:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: Using C to check file patten on directory</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-c-to-check-file-patten-on-directory/m-p/3824795#M100429</link>
      <description>Yes, possible in plenty, plenty of ways.&lt;BR /&gt;&lt;BR /&gt;As many ways as you care to write a string matching algorithm.</description>
      <pubDate>Mon, 17 Jul 2006 09:21:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-c-to-check-file-patten-on-directory/m-p/3824795#M100429</guid>
      <dc:creator>TwoProc</dc:creator>
      <dc:date>2006-07-17T09:21:37Z</dc:date>
    </item>
    <item>
      <title>Re: Using C to check file patten on directory</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-c-to-check-file-patten-on-directory/m-p/3824796#M100430</link>
      <description>Hi Henry:&lt;BR /&gt;&lt;BR /&gt;Pattern matching uses regular expressions.  This is easily done with 'Perl', 'awk' and 'sed'.  If you would be more specific it would be easy to help.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 17 Jul 2006 09:22:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-c-to-check-file-patten-on-directory/m-p/3824796#M100430</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-07-17T09:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: Using C to check file patten on directory</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-c-to-check-file-patten-on-directory/m-p/3824797#M100431</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;of course regcomp()/regexec() is the interface that can do all the regular expression stuff.&lt;BR /&gt;&lt;BR /&gt;But:&lt;BR /&gt;- if you need just the matching of a string like "ls fixedstring*", a simple strstr() in your readdir()-loop will do it.&lt;BR /&gt;- the regcmp()-pattern are that you use in grep, vi, .... These are NOT identical with the pattern in (k|c|tc)sh for filename globbing.&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Mon, 17 Jul 2006 09:31:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-c-to-check-file-patten-on-directory/m-p/3824797#M100431</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2006-07-17T09:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: Using C to check file patten on directory</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-c-to-check-file-patten-on-directory/m-p/3824798#M100432</link>
      <description>Thanks for the tips.. if I am using popen(), is there anyway to redirect the error message so that it will not show up on the screen? =)</description>
      <pubDate>Mon, 17 Jul 2006 10:06:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-c-to-check-file-patten-on-directory/m-p/3824798#M100432</guid>
      <dc:creator>Henry Chua</dc:creator>
      <dc:date>2006-07-17T10:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: Using C to check file patten on directory</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-c-to-check-file-patten-on-directory/m-p/3824799#M100433</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;act just as you would do in normal shell command, e.g.&lt;BR /&gt;&lt;BR /&gt;f = popen("ls xyz* 2&amp;gt;/dev/null","r");&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Mon, 17 Jul 2006 10:08:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-c-to-check-file-patten-on-directory/m-p/3824799#M100433</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2006-07-17T10:08:22Z</dc:date>
    </item>
  </channel>
</rss>

