Bonjour !
Question simple, comment passer de ceci :
à cela en char* (avec les points)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 unsigned char aby_ipv4[4] = {10,5,2,212};
strcpy est-il une bonne piste ? Pour l'instant j'ai ceci :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 char * c_ipv4 = "10.5.2.212";
mais ça me sort ça
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 WORD w_ipv4_char_1 = aby_ipv4[0]; WORD w_ipv4_char_2 = aby_ipv4[1]; WORD w_ipv4_char_3 = aby_ipv4[2]; WORD w_ipv4_char_4 = aby_ipv4[3]; char * c_index_nb1 = reinterpret_cast<char * const>(&w_ipv4_char_1); char * c_index_nb2 = reinterpret_cast<char * const>(&w_ipv4_char_2); char * c_index_nb3 = reinterpret_cast<char * const>(&w_ipv4_char_3); char * c_index_nb4 = reinterpret_cast<char * const>(&w_ipv4_char_4); strcpy(c_path_node,(c_index_nb1)); strcat(c_path_node,"."); strcat(c_path_node,(c_index_nb2)); strcat(c_path_node,"."); strcat(c_path_node,(c_index_nb3)); strcat(c_path_node,"."); strcat(c_path_node,(c_index_nb4)); puts(c_path_node);
et je voudrai ça
Merci pour votre aide !
Partager