07-11-2012 04:06 AM
Bonjour,
j'essaye de récupérer un entier sous format hexa depuis un texte saisi dans .uir
GetCtrlAttribute (PANEL, PANEL_first_mac_adress, ATTR_STRING_TEXT_LENGTH, &length);
first_mac_adress = (char *)malloc(length+1);
GetCtrlVal (PANEL ,PANEL_first_mac_adress, first_mac_adress);
Scan(first_mac_adress,"%s>%x",first_mac);
la dernière commande scan lance un erreur de compilation:
NON-FATAL RUN-TIME ERROR: "MacAdressAssociation.c", line 34, col 43, thread id 0x00000A88: Reference parameter expected.
Je dois mettre quoi comme paramètre dans scan ayant besoin d'un entier de 12 chiffres en hexa
merci.
Solved! Go to Solution.
07-11-2012 04:34 AM - edited 07-11-2012 04:36 AM
Sorry for answering in English and possibly not answering completely to your question: I don't speak French ![]()
Scan expects a string as the first parameter and pointers as target parameters, whose type must match the format code. In your case, format code "X" expects an integer as target element, so you should define your first_mac variable as integer and pass it as a pointer (i.e. &first_mac).
Please note that "X" scanning code stops scanning at the first non-numeric character (including A÷F letters), so in case your string is formatted as usual for mac addresses like "12:34:56:78:9A:BC" you will retrieve only the fisrt element of the address. In case you want to retrieve more elements you can use the [x] separator and add the appropriate targets to the function:
Scan (first_mac_adress, "%x[x]%x", &b1, &b2);
PS: are you aware of the existence of a French forum board?
07-11-2012 04:43 AM
Hi RobertoBozzelo,
thanks for the answer, i'll try it (seems gonna work).
i can speak english, so i'll post questions in english from now on.
🙂
Best regards.