1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
int size_template;
int m=9;
int N=8;
int result_strcmp;
unsigned char *temp = NULL ;
printf("\nEnter the size of the template you want:\n ");
scanf("%d", &size_template);
#define FORMAT "%1[01]"
char template[9] = { 0 };
int ret = 0;
unsigned char part[(n+1)*8/N];
for(i=0;i<N;i=i+N)
{
for(j=0;j<N;j++)
{
part[j]=tab2[j+i];
printf("%c",part[j]);
}
do
{
printf ("Entrer la chaine a rechercher :");
ret = scanf (FORMAT FORMAT FORMAT FORMAT FORMAT FORMAT FORMAT FORMAT, template, template + 1, template + 2, template + 3, template + 4, template + 5, template + 6, template + 7);
scanf ("%*[^\n]"), getchar ();/* flush input buffer */
template[ret] = 0;/* don't forget that C strings end with nul byte */
}
while (ret < 3);
printf ("nombre d'occurences : %u\n", count (part, template));
} |
Partager