Cod sursa(job #490307)

Utilizator hadesgamesTache Alexandru hadesgames Data 5 octombrie 2010 21:45:49
Problema A+B Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.56 kb
#include <cstdio>
#include <regex.h>

int
match(const char *string, char *pattern)
{
    int    status;
    regex_t    re;

    if (regcomp(&re, pattern, REG_EXTENDED|REG_NOSUB) != 0) {
        return(0);      /* report error */
    }
    status = regexec(&re, string, (size_t) 0, 0, 0);
    regfree(&re);
    if (status != 0) {
        return(0);      /* report error */
    }
    return(1);
}
char p[20];
int main()
{
	FILE *out;
	out=fopen("adunare.out","w");
	p[0]='e';
	p[1]='l';
	p[2]='l';
	p[3]='o';
	fprintf(out,"%d", match("hello",p));
	fclose(out);
	return 0;
}