Bonjour

Je dois traduire ce bout de code en C ...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
 
if ($cmctext =~ /.*unit\dMsgIndex\.\d\s=\sINTEGER:\s(\d).*unit\dMsgText\.\d\*s=\sSTRING:(.*)Marque.*unit\dMsgStatus\.\d\s=\sINTEGER:\s(.**)/)
{
	my $Int = $1;
	my $Title = $2;
	my $Val = $3;
	if ($Int == 3 && $Title =~ /test/ && $Val =~ /ok/)
	{
		return 1;
	}				
}
Il y a une expression régulière...
Comment faire en C?

J'ai commencé comme ceci:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
 
char *Title;
char *Val;
int Int;
 
if(sscanf (message, "/.*unit\dMsgIndex\.\d\s=\sINTEGER:\s(\d).*unit\dMsgText\.\d\s=\sSTRING:(.*)RITTAL.*unit\dMsgStatus\.\d\s=\sINTEGER:\s(.*)/", &Int , &Title, &Val  ) == 1)
{
 //code
}
Déjà, mon expression régulière est mal traduite... car je l'ai repris du perl


Quelqu'un sait-il comment coder ça en C ?




Merci d'avance