Bonjour, j'aimerai mettre mon résultat aléatoire string dans exampleBytes[3] Mais j'ai le message d'erreur suivant :
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 #include <iostream> #include <windows.h> #include <string> #include <ctime> using namespace std; int main(){ int match_aleatoire; srand(time(0)); const string matchs[3] = {"0x82, 0x00, 0x01", "0x01, 0x00, 0x00", "0x01, 0x01, 0x00"}; match_aleatoire = rand() % 3; string match = matchs[match_aleatoire]; BYTE exampleBytes[3] = {match}; system("pause"); return 0; }Comment faire ?[Error] cannot convert 'std::string {aka std::basic_string<char>}' to 'BYTE {aka unsigned char}' in initialization
Partager