Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #100096
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: C newb - Part III - find a .jhr file in a directory - seg fault |
| Date | 2016-12-23 14:13 -0800 |
| Organization | None to speak of |
| Message-ID | <lnbmw2b8fu.fsf@kst-u.example.com> (permalink) |
| References | <azB3A.89805$dL2.72348@fx12.iad> <o3jnfl$n11$1@dont-email.me> |
BartC <bc@freeuk.com> writes:
> On 12/12/2016 17:58, S390 wrote:
>> finding all *.jhr in a directory
>
>> while ((dir = readdir(d)) != NULL)
>> {
>> ret = strchr(dir->d_name, ch);
>> printf("String after |%c| is - |%s|\n", ch, ret);
>>
>> //if (strcmp(dir->d_name,"TESTJAMNNTPD.jhr") == 0) //
>
>
> Have a look at the 'fnmatch()' function which will do wildcard matching
> for you. Something like:
>
> if (fnmatch("*.jhr", dir->d_name, 0)) ...
>
> 'man fnmatch' for further details.
Be aware that fnmatch() is defined by POSIX, not by ISO C, and it might
not be available on all systems.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
C newb - Part III - find a .jhr file in a directory - seg fault S390 <s390@tampascanner.info> - 2016-12-12 17:58 +0000
Re: C newb - Part III - find a .jhr file in a directory - seg fault Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-12 22:18 +0000
Re: C newb - Part III - find a .jhr file in a directory - seg fault S390 <s390@tampascanner.info> - 2016-12-20 22:12 +0000
Re: C newb - Part III - find a .jhr file in a directory - seg fault Barry Schwarz <schwarzb@dqel.com> - 2016-12-20 14:38 -0800
Re: C newb - Part III - find a .jhr file in a directory - seg fault S390 <s390@tampascanner.info> - 2016-12-23 16:08 +0000
Re: C newb - Part III - find a .jhr file in a directory - seg fault Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-23 16:34 +0000
Re: C newb - Part III - find a .jhr file in a directory - seg fault "James R. Kuyper" <jameskuyper@verizon.net> - 2017-01-03 16:16 -0500
Re: C newb - Part III - find a .jhr file in a directory - seg fault Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2016-12-23 12:22 -0500
Re: C newb - Part III - find a .jhr file in a directory - seg fault BartC <bc@freeuk.com> - 2016-12-23 17:40 +0000
Re: C newb - Part III - find a .jhr file in a directory - seg fault Keith Thompson <kst-u@mib.org> - 2016-12-23 14:13 -0800
Re: C newb - Part III - find a .jhr file in a directory - seg fault Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2016-12-23 17:22 -0500
Re: C newb - Part III - find a .jhr file in a directory - seg fault BartC <bc@freeuk.com> - 2016-12-23 22:35 +0000
csiph-web