LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

scan

Solved!
Go to solution

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.

0 Kudos
Message 1 of 3
(3,151 Views)
Solution
Accepted by topic author FibiIA

Sorry for answering in English and possibly not answering completely to your question: I don't speak French Smiley Wink

 

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?



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 3
(3,148 Views)

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.

 

0 Kudos
Message 3 of 3
(3,140 Views)