jihedcom2011
Messages postés9Date d'inscriptionsamedi 10 avril 2010StatutMembreDernière intervention17 mai 2010
-
11 mai 2010 à 03:28
jihedcom2011
Messages postés9Date d'inscriptionsamedi 10 avril 2010StatutMembreDernière intervention17 mai 2010
-
13 mai 2010 à 18:03
Bonjour tous le monde , je suis un débutant en C. j'ai quelque erreurs lorsque j'ai compilé mon code qui est responsable de lire de registre
Code : C
btree regData(int xfsVersion, int v) {
u = v; //set global flag u, if parameter "-v"
char start[10] = ""; //has been set
DWORD iSubKey = 0;
HKEY hKeyF; //Handle to father key
HKEY hKey; //Handle to current key
if (xfsVersion == 2) {
if (u == 1) printf("Start building tree - ");
hKeyF = WFS_CFG_HKEY_XFS_ROOT; //hKey of Father
hKey = WFS_CFG_HKEY_XFS_ROOT; //hKey of current key
root = Tree(hKeyF, hKey, start, iSubKey);
if (u == 1) printf("End building tree\n");
}
else if (xfsVersion == 3) {
if (u == 1) printf("Start building tree 1 - ");
hKeyF = WFS_CFG_HKEY_USER_DEFAULT_XFS_ROOT; //hKey of Father
hKey = WFS_CFG_HKEY_USER_DEFAULT_XFS_ROOT; //hKey of current key
root1 = Tree(hKeyF, hKey, start, iSubKey);
if (u == 1) printf("End building tree 1\n");
if (u == 1) printf("Start building tree 2 - ");
levelNow = 0; //set level to 0 for second tree
hKeyF = WFS_CFG_HKEY_MACHINE_XFS_ROOT; //hKey of Father
hKey = WFS_CFG_HKEY_MACHINE_XFS_ROOT; //hKey of current key
root2 = Tree(hKeyF, hKey, start, iSubKey);
if (u == 1) printf("End building tree 2\n");
if (u == 1) printf("Start combinig trees\n");
root1->right = NULL;
root2->right = NULL;
if (find_log(root2->left) != NULL) { //if Logical_Services node in tree root 2
if (root2->left->right == NULL) { //if(Logical_Services) has no neighbour
root2->left->right = root1->left;
root=root2; //root is root2
}
else {
printf("Error when combining the two trees\n\n");
}
}
else { //else Logical_Services in this tree
if (root1->left->right == NULL) { //if(Logical_Services) has no neighbour
root1->left->right = root2->left;
root = root1; //root is root1
}
else {
printf("Error when combining the two trees\n\n");
}
}
if (u == 1) printf("End combining trees\n\n");
}
if (root !NULL) root->right NULL; //set right pointer of root key NULL
strcpy(root->key, "WOSA/XFS_ROOT"); //give root key a name
return root;
}
ce code a génère en compilation 28 erreur :
Erreur 2 error C2143: erreur de syntaxe : absence de ';' avant 'type'
Erreur 3 error C2275: 'DWORD' : utilisation non conforme de ce type comme expression
Erreur 4 error C2146: erreur de syntaxe : absence de ';' avant l'identificateur 'iSubKey'
Erreur 5 error C2065: 'iSubKey' : identificateur non déclaré
Erreur 6 error C2275: 'HKEY' : utilisation non conforme de ce type comme expression
Erreur 7 error C2146: erreur de syntaxe : absence de ';' avant l'identificateur 'hKeyF'
Erreur 8 error C2065: 'hKeyF' : identificateur non déclaré
Erreur 9 error C2275: 'HKEY' : utilisation non conforme de ce type comme expression
Erreur 10 error C2146: erreur de syntaxe : absence de ';' avant l'identificateur 'hKey'
Erreur 11 error C2065: 'hKey' : identificateur non déclaré
Erreur 12 error C2065: 'hKeyF' : identificateur non déclaré
Erreur 14 error C2065: 'hKey' : identificateur non déclaré
Erreur 16 error C2065: 'hKeyF' : identificateur non déclaré
Erreur 19 error C2065: 'hKey' : identificateur non déclaré
Erreur 22 error C2065: 'start' : identificateur non déclaré
Erreur 25 error C2065: 'iSubKey' : identificateur non déclaré
Erreur 26 error C2065: 'hKeyF' : identificateur non déclaré
Erreur 28 error C2065: 'hKey' : identificateur non déclaré
Erreur 30 error C2065: 'hKeyF' : identificateur non déclaré
Erreur 33 error C2065: 'hKey' : identificateur non déclaré
Erreur 36 error C2065: 'start' : identificateur non déclaré
Erreur 39 error C2065: 'iSubKey' : identificateur non déclaré
Erreur 40 error C2065: 'hKeyF' : identificateur non déclaré
Erreur 42 error C2065: 'hKey' : identificateur non déclaré
Erreur 44 error C2065: 'hKeyF' : identificateur non déclaré
Erreur 47 error C2065: 'hKey' : identificateur non déclaré
Erreur 50 error C2065: 'start' : identificateur non déclaré
Erreur 53 error C2065: 'iSubKey' : identificateur non déclaré
NB : le bout de code qui a généré les erreurs est celui de l'initialisation des variables suivant :
u = v; //set global flag u, if parameter "-v"
char start[10] = ""; //has been set
DWORD iSubKey = 0;
HKEY hKeyF; //Handle to father key
HKEY hKey; //Handle to current key