Au secours (language C)

meftahie Messages postés 21 Date d'inscription   Statut Membre -  
meftahie Messages postés 21 Date d'inscription   Statut Membre -
Bonjour,
j ai cette structure structure archi{ int D[8]; unsigned int A[8]; unsigned int PC;}.
En fait je doit réaliser une seule fonction qui affiche le contenu du registre que l'untilisateur va lui demander
par exemple:
entrez le nom du registre:
A[0]
le contenu du registre est :
xxxxxxxx
mais je ne sais pas comment faire un main qui peut réaliser ca, donc si vous avez un idée n'hesitez pas à la partager.
merci
Configuration: Windows Vista
Internet Explorer 7.0

1 réponse

  1. meftahie Messages postés 21 Date d'inscription   Statut Membre 1
     
    voila donc mon programme:
    #include <stdio.h>
    #include <stdlib.h>
    #include <fcntl.h>
    #include <string.h>

    #include "elfLoader.h"
    #include "architecture.h"

    unsigned int *affich(int a , ElfSection *section)
    {
    archi A;
    int i,c;
    printf("Section : %s\n", section -> name);
    for(i=0 ; i<section->nbOfBytes ;i++)
    c=a+i;
    printf("adresse : %d instruction:%d\n", &(A.memoire[c]),A.memoire[c]);
    }
    ma fonction main:

    #include <stdio.h>
    #include <stdlib.h>
    #include <fcntl.h>
    #include <string.h>

    #include "architecture.h"
    #include "elfLoader.h"

    int calc(int, int);

    main(int argc, char *argv[] )
    { char * filename = NULL;
    Elf *e = NULL;
    ElfSection *textSection = NULL;
    ElfSection *dataSection = NULL;
    ElfSymbolTable *symTable = NULL;

    archi A;

    if ((argc < 2) || (argc > 2)) {
    printf("Usage: %s <fichier_elf> \n", argv[0]);
    exit(1);
    }

    printf("Opening File %s...\n", argv[1]);
    filename = argv[1];

    if ((e = openElfFile(filename)) != NULL) {
    /* get everything */
    getTextSection(e, &textSection);
    getDataSection(e, &dataSection);
    getSymbolTable(e, &symTable);

    int a = calc(a,textSection->nbOfBytes);

    affich(0 , &textSection);
    affich(a , &dataSection);
    }
    printf("That's all folks!\n");
    }

    mais ce programme va m'afficher le contenu de tous les registres à la fois, et moi je cherche à afficher juste le contenu du registe que l utilisateur va lui demander.
    merci
    0