Epeksergasia wildcards *,?

Mihalis Tsoukalos mike at intrasoft.gr
Thu Feb 18 17:46:33 EET 1999


> H fnmatch fainetai na kanei afto pou thelo arkei na anoikso to directory
> kai na diabaso ola ta arxeia tou kai gia kathena apo ta arxeia na testaro
> an einai simfono me to pattern.
> Isos se sindiasmo me tin scandir na kano afto pou thelo pio efkola.

Telika kati katafera.
H ousia einai i xrisi tis fnmatch. [tis opoias tin iparksi aggnoousa]
Na simeiothei oti den eksetazei tin periptosi pou to wildcard anaferetai
se directory. Diladi mia periptosi san /usr/inc*/*.h, para mono
periptoseis tis morfis /usr/include/*.h
Paratheto kai ligo kodika parakato.

// Me tis basename kai dirname ksexorizei to directory name apo to pattern
// kai meta opos parakato:

	while ( (direntp = readdir(dirp)) != NULL )
	{
		vfnmatch = fnmatch(pattern, direntp->d_name, 0);
		if ( vfnmatch == 0 )
		{
			// Do what you want
		}	
	}
	closedir(dirp);
	return true;
}

kalo apogebma,
mixalis.

--
====================================================================
Gia boithia (h na diagrafhte) e-mail sto majordomo at hellug.gr
Ta archives tis listas einai sto http://lists.hellug.gr
prin steilete kapoia erothsh psakte mipos exei hdh apanththei.
Gia opoiodipote problima stilte e-mail ston owner-linux-greek-users
====================================================================



More information about the Linux-greek-users mailing list