IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

 C Discussion :

Programme équivalent à DIR [Débutant(e)]


Sujet :

C

  1. #101
    Membre averti Avatar de _SamSoft_
    Profil pro
    Étudiant
    Inscrit en
    Février 2007
    Messages
    798
    Détails du profil
    Informations personnelles :
    Âge : 32
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Février 2007
    Messages : 798
    Points : 345
    Points
    345
    Par défaut
    NAME OR <ENTER> FOR EXIT) : c:\\dev-cpp
    FOLDER c:\\dev-cpp:
    NAME OR <ENTER> FOR EXIT) :
    NAME OR <ENTER> FOR EXIT) : c:\dev-cpp
    FOLDER c:\dev-cpp:
    NAME OR <ENTER> FOR EXIT) :

  2. #102
    Membre averti Avatar de _SamSoft_
    Profil pro
    Étudiant
    Inscrit en
    Février 2007
    Messages
    798
    Détails du profil
    Informations personnelles :
    Âge : 32
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Février 2007
    Messages : 798
    Points : 345
    Points
    345
    Par défaut
    Votre méthode ne fonction peut être que sous Linux ?

  3. #103
    Expert confirmé
    Avatar de Thierry Chappuis
    Homme Profil pro
    Enseignant Chercheur
    Inscrit en
    Mai 2005
    Messages
    3 499
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : Suisse

    Informations professionnelles :
    Activité : Enseignant Chercheur
    Secteur : Industrie Pharmaceutique

    Informations forums :
    Inscription : Mai 2005
    Messages : 3 499
    Points : 5 360
    Points
    5 360
    Par défaut
    Quelle est la valeur retournée par la fonction test() ci-dessous???

    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
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    int list(char *directory, size_t sizeDir)
    {
        DIR *dir = NULL;
        int err;
        struct dirent *file = NULL;
        struct stat infos;
        char cwd[32] = "";
     
        if ((dir = opendir(directory)) == NULL)
        {
            return 4;
        }
        printf("FOLDER %s:\n", directory);
     
        /* -tc- on memorise le repertoire courant de travail */
        if (getcwd(cwd, sizeof cwd) == NULL)
        {
            /* -tc- gestion des erreurs a ameliorer */
            return 3;
        }
        /* -tc- on change le repertoire de travail courant qui devient directory */
        if (chdir(directory) != 0)
        {
            /* -tc- idem: a ameliorer */
            return 2;
        }
     
        while ((file = readdir(dir)) != NULL)
        {
            /* -tc- ici, tu appelais deux fois stat() */
            err = stat(file->d_name, &infos);
            if (strcmp(file->d_name, ".") && strcmp(file->d_name, ".."))
            {
                if (err == 0)
                {
                    if (S_ISDIR (infos.st_mode))
                    {
                        printf("\n[FOLDER]\t%s\n", file->d_name);
                    }
                    else
                    {
                        printf("\n[FILE]\t%s\n", file->d_name);
                    }
     
                }
                else
                {
                    printf ("'%s' IS UNKNOW\n", directory);
                    chdir(cwd);
                    return 1;
                }
            }
        }
     
        /* -tc- on retourne dans le repertoire de travail initial */
        chdir(cwd);
        printf("\nEND OF THE FOLDER: %s\n", directory);
     
        closedir(dir);
     
        (void) sizeDir;
     
        return 0;
    }
    Thierry
    "The most important thing in the kitchen is the waste paper basket and it needs to be centrally located.", Donald Knuth
    "If the only tool you have is a hammer, every problem looks like a nail.", probably Abraham Maslow

    FAQ-Python FAQ-C FAQ-C++

    +

  4. #104
    Expert éminent sénior
    Avatar de Emmanuel Delahaye
    Profil pro
    Retraité
    Inscrit en
    Décembre 2003
    Messages
    14 512
    Détails du profil
    Informations personnelles :
    Âge : 67
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Retraité

    Informations forums :
    Inscription : Décembre 2003
    Messages : 14 512
    Points : 20 985
    Points
    20 985
    Par défaut
    Citation Envoyé par _SamSoft_ Voir le message
    Le problème c'est que je ne souhaite pas parcourir une arboressence. Je m'explique.
    Enfin ! Depuis le début, je te demande ce que tu veux faire exactement... On ne peut pas le deviner, on est pas dans ta tête...

    Alors il faut cesser ces appels récursifs...
    Pas de Wi-Fi à la maison : CPL

  5. #105
    Membre averti Avatar de _SamSoft_
    Profil pro
    Étudiant
    Inscrit en
    Février 2007
    Messages
    798
    Détails du profil
    Informations personnelles :
    Âge : 32
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Février 2007
    Messages : 798
    Points : 345
    Points
    345
    Par défaut
    Thierry : Aucune fonction test

    Emmanuel : Je l'ai dis 2 fois

  6. #106
    Expert confirmé
    Avatar de Thierry Chappuis
    Homme Profil pro
    Enseignant Chercheur
    Inscrit en
    Mai 2005
    Messages
    3 499
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : Suisse

    Informations professionnelles :
    Activité : Enseignant Chercheur
    Secteur : Industrie Pharmaceutique

    Informations forums :
    Inscription : Mai 2005
    Messages : 3 499
    Points : 5 360
    Points
    5 360
    Par défaut
    Citation Envoyé par _SamSoft_ Voir le message
    Thierry : Aucune fonction test

    Emmanuel : Je l'ai dis 2 fois
    Excuse-moi, la fonction list() que j'ai posté ici. A part ça, toutes les fonctions utilisées sont POSIX.1 et sont toutes implantées par MinGW. Il n'y a aucune supposition Linux-spécifique au sein de la fonction list().

    Thierry
    "The most important thing in the kitchen is the waste paper basket and it needs to be centrally located.", Donald Knuth
    "If the only tool you have is a hammer, every problem looks like a nail.", probably Abraham Maslow

    FAQ-Python FAQ-C FAQ-C++

    +

  7. #107
    Membre averti Avatar de _SamSoft_
    Profil pro
    Étudiant
    Inscrit en
    Février 2007
    Messages
    798
    Détails du profil
    Informations personnelles :
    Âge : 32
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Février 2007
    Messages : 798
    Points : 345
    Points
    345
    Par défaut
    Tout dépend de s'il y a des erreurs où pas, si tout ce passe bien :

    return 0;

  8. #108
    Expert confirmé
    Avatar de Thierry Chappuis
    Homme Profil pro
    Enseignant Chercheur
    Inscrit en
    Mai 2005
    Messages
    3 499
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : Suisse

    Informations professionnelles :
    Activité : Enseignant Chercheur
    Secteur : Industrie Pharmaceutique

    Informations forums :
    Inscription : Mai 2005
    Messages : 3 499
    Points : 5 360
    Points
    5 360
    Par défaut
    Citation Envoyé par _SamSoft_ Voir le message
    Tout dépend de s'il y a des erreurs où pas, si tout ce passe bien :

    return 0;
    C'est ce que retourne la fonction list() ou c'est ce que tu penses? L'intérêt de la manipulation est d'identifier où se produit l'erreur. As-tu essayé avec la fonction que j'ai posté ici?

    Thierry
    "The most important thing in the kitchen is the waste paper basket and it needs to be centrally located.", Donald Knuth
    "If the only tool you have is a hammer, every problem looks like a nail.", probably Abraham Maslow

    FAQ-Python FAQ-C FAQ-C++

    +

  9. #109
    Membre averti Avatar de _SamSoft_
    Profil pro
    Étudiant
    Inscrit en
    Février 2007
    Messages
    798
    Détails du profil
    Informations personnelles :
    Âge : 32
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Février 2007
    Messages : 798
    Points : 345
    Points
    345
    Par défaut
    Retour : 3

    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
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
     
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <sys/types.h>
    #include <dirent.h>
    #include <errno.h>
    #include <sys/stat.h>
    #include <unistd.h>
    #include "myHeader.h"
    int list(char *directory, size_t sizeDir);
     
    int main(void)
    {
      int end, rslt=0;
      size_t sizeDir;
      char directory[256];
      sizeDir = sizeof directory;
     
     
       do
       {
          printf ("NAME OR <ENTER> FOR EXIT) : ");
          fgets (directory, sizeof directory, stdin); /* we take the path */
          fclean (directory, stdin);
          end = (directory[0] == '\0');
          if (!end)
          {
             rslt = list(directory, sizeDir);
         fprintf(stdout, "%i", rslt);
          }
       }
       while (!end); //while end[0] != '\0'
       return 0;
    }
    int list(char *directory, size_t sizeDir)
    {
        DIR *dir = NULL;
        int err;
        struct dirent *file = NULL;
        struct stat infos;
        char cwd[32] = "";
     
        if ((dir = opendir(directory)) == NULL)
        {
            return 4;
        }
        printf("FOLDER %s:\n", directory);
     
        /* -tc- on memorise le repertoire courant de travail */
        if (getcwd(cwd, sizeof cwd) == NULL)
        {
            /* -tc- gestion des erreurs a ameliorer */
            return 3;
        }
        /* -tc- on change le repertoire de travail courant qui devient directory */
        if (chdir(directory) != 0)
        {
            /* -tc- idem: a ameliorer */
            return 2;
        }
     
        while ((file = readdir(dir)) != NULL)
        {
            /* -tc- ici, tu appelais deux fois stat() */
            err = stat(file->d_name, &infos);
            if (strcmp(file->d_name, ".") && strcmp(file->d_name, ".."))
            {
                if (err == 0)
                {
                    if (S_ISDIR (infos.st_mode))
                    {
                        printf("\n[FOLDER]\t%s\n", file->d_name);
                    }
                    else
                    {
                        printf("\n[FILE]\t%s\n", file->d_name);
                    }
     
                }
                else
                {
                    printf ("'%s' IS UNKNOW\n", directory);
                    chdir(cwd);
                    return 1;
                }
            }
        }
     
        /* -tc- on retourne dans le repertoire de travail initial */
        chdir(cwd);
        printf("\nEND OF THE FOLDER: %s\n", directory);
     
        closedir(dir);
     
        (void) sizeDir;
     
        return 0;
    }
    Je ne comprend pas à quoi sert :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    /* -tc- on memorise le repertoire courant de travail */
        if (getcwd(cwd, sizeof cwd) == NULL)
        {
            /* -tc- gestion des erreurs a ameliorer */
            return 3;
        }
    Vu que l'on ne travail que dans directory ?!

  10. #110
    Expert confirmé
    Avatar de Thierry Chappuis
    Homme Profil pro
    Enseignant Chercheur
    Inscrit en
    Mai 2005
    Messages
    3 499
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : Suisse

    Informations professionnelles :
    Activité : Enseignant Chercheur
    Secteur : Industrie Pharmaceutique

    Informations forums :
    Inscription : Mai 2005
    Messages : 3 499
    Points : 5 360
    Points
    5 360
    Par défaut
    Lorsque tu passes file->d_name à la fonction stat(), elle regarde dans le 'current working directory', et non dans directory...

    Thierry
    "The most important thing in the kitchen is the waste paper basket and it needs to be centrally located.", Donald Knuth
    "If the only tool you have is a hammer, every problem looks like a nail.", probably Abraham Maslow

    FAQ-Python FAQ-C FAQ-C++

    +

  11. #111
    Membre averti Avatar de _SamSoft_
    Profil pro
    Étudiant
    Inscrit en
    Février 2007
    Messages
    798
    Détails du profil
    Informations personnelles :
    Âge : 32
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Février 2007
    Messages : 798
    Points : 345
    Points
    345
    Par défaut
    Ah ok Mais vous dîtes que chez vous ca marche alors pourquoi ca ne marche pas chez moi (sachant que ca compile et que le path est bon -_- )

  12. #112
    Expert confirmé
    Avatar de Thierry Chappuis
    Homme Profil pro
    Enseignant Chercheur
    Inscrit en
    Mai 2005
    Messages
    3 499
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : Suisse

    Informations professionnelles :
    Activité : Enseignant Chercheur
    Secteur : Industrie Pharmaceutique

    Informations forums :
    Inscription : Mai 2005
    Messages : 3 499
    Points : 5 360
    Points
    5 360
    Par défaut
    Le code suivant fonctionne. C'était le tampon cwd qui n'était pas assez grand. En effet, les chemins sous Windows sont souvent plus long que sous Linux. En passant de char cwd[32]; à char cwd[100];, c'est en ordre! (testé sous WinXP)

    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
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <sys/types.h>
    #include <dirent.h>
    #include <errno.h>
    #include <sys/stat.h>
    #include <unistd.h>
    #include "myHeader.h"
     
    int list(char *directory, size_t sizeDir);
     
    int main(void)
    {
      int end, rslt=0;
      size_t sizeDir;
      char directory[256];
      sizeDir = sizeof directory;
     
     
       do
       {
          printf ("NAME OR <ENTER> FOR EXIT) : ");
          fgets (directory, sizeof directory, stdin); /* we take the path */
          fclean (directory, stdin);
          end = (directory[0] == '\0');
          if (!end)
          {
             rslt = list(directory, sizeDir);
         fprintf(stdout, "rslt = %i", rslt);
          }
       }
       while (!end); //while end[0] != '\0'
       return 0;
    }
    int list(char *directory, size_t sizeDir)
    {
        DIR *dir = NULL;
        int err;
        struct dirent *file = NULL;
        struct stat infos;
        char cwd[100] = "";
     
        if ((dir = opendir(directory)) == NULL)
        {
            return EXIT_FAILURE;
        }
        printf("FOLDER %s:\n", directory);
     
        /* -tc- on memorise le repertoire courant de travail */
        if (getcwd(cwd, sizeof cwd) == NULL)
        {
            /* -tc- gestion des erreurs a ameliorer */
            return EXIT_FAILURE;
        }
        /* -tc- on change le repertoire de travail courant qui devient directory */
        if (chdir(directory) != 0)
        {
            /* -tc- idem: a ameliorer */
            return EXIT_FAILURE;
        }
     
        while ((file = readdir(dir)) != NULL)
        {
            /* -tc- ici, tu appelais deux fois stat() */
            err = stat(file->d_name, &infos);
            if (strcmp(file->d_name, ".") && strcmp(file->d_name, ".."))
            {
                if (err == 0)
                {
                    if (S_ISDIR (infos.st_mode))
                    {
                        printf("\n[FOLDER]\t%s\n", file->d_name);
                    }
                    else
                    {
                        printf("\n[FILE]\t%s\n", file->d_name);
                    }
     
                }
                else
                {
                    printf ("'%s' IS UNKNOW\n", directory);
                    chdir(cwd);
                    return EXIT_FAILURE;
                }
            }
        }
     
        /* -tc- on retourne dans le repertoire de travail initial */
        chdir(cwd);
        printf("\nEND OF THE FOLDER: %s\n", directory);
     
        closedir(dir);
     
        (void) sizeDir;
     
        return EXIT_SUCCESS;
    }
    Thierry
    "The most important thing in the kitchen is the waste paper basket and it needs to be centrally located.", Donald Knuth
    "If the only tool you have is a hammer, every problem looks like a nail.", probably Abraham Maslow

    FAQ-Python FAQ-C FAQ-C++

    +

  13. #113
    Membre averti Avatar de _SamSoft_
    Profil pro
    Étudiant
    Inscrit en
    Février 2007
    Messages
    798
    Détails du profil
    Informations personnelles :
    Âge : 32
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Février 2007
    Messages : 798
    Points : 345
    Points
    345
    Par défaut
    Ca fonction à merveille (merci). Je vais étudier tout cela en détails demain

  14. #114
    Membre averti Avatar de _SamSoft_
    Profil pro
    Étudiant
    Inscrit en
    Février 2007
    Messages
    798
    Détails du profil
    Informations personnelles :
    Âge : 32
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Février 2007
    Messages : 798
    Points : 345
    Points
    345
    Par défaut
    Désolé pour tout ce temps (j'avais une tonne de devoirs -_- ):

    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
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
     
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <sys/types.h>
    #include <dirent.h>
    #include <errno.h>
    #include <sys/stat.h>
    #include <unistd.h>
    #include "myHeader.h"
     
    int list(char *directory, size_t sizeDir);
     
    int main(void)
    {
      int end, error=0;
      size_t sizeDir;
      char directory[256];
      sizeDir = sizeof directory;
     
     
       do
       {
          printf ("Path or <enter> for exit: ");
          fgets (directory, sizeof directory, stdin); /* -sh- we take the path */
          fclean (directory, stdin);
          end = (directory[0] == '\0');
          if (!end)
          {
             error = list(directory, sizeDir);
         switch(error)
         {
         case 0:
             fprintf(stdout, "\nNo Error\n\n");
             break;
         case 1:
             fprintf(stdout, "\n%s is unknown\n\n", directory);
             break;
         case 2:
             fprintf(stdout, "\nInternal error\n\n");
             break;
         case 3:
             fprintf(stdout, "\nInternal error\n\n");
             break;
         case 4:
             fprintf(stdout, "\nError when reading %s\n\n", directory);
             break;
         }
          }
       }
       while (!end); /* while end[0] != '\0' */
       return 0;
    }
    int list(char *directory, size_t sizeDir)
    {
      char cwd[256] = "";
        DIR *dir = NULL;
        int err;
        struct dirent *file = NULL;
        struct stat infos;
     
        if ((dir = opendir(directory)) == NULL)
        {
            return 4;
        }
        printf("FOLDER %s:\n", directory);
     
        /* -tc- we memorise the current working directory */
        if (getcwd(cwd, sizeof cwd) == NULL)
            return 3;
        if (chdir(directory) != 0)
            return 2;
        while ((file = readdir(dir)) != NULL)
        {
            err = stat(file->d_name, &infos);
            if (strcmp(file->d_name, ".") && strcmp(file->d_name, ".."))
            {
                if (err == 0)
                {
                    if (S_ISDIR (infos.st_mode))
                    {
                        printf("\n[Folder]\t%s\n", file->d_name);
                    }
                    else
                    {
                        printf("\n[File]\t%s\n", file->d_name);
                    }
     
                }
                else
                {
                    chdir(cwd);
                    return 1;
                }
            }
        }
     
        /* -tc- we return the initial repertory */
        chdir(cwd);
        printf("\nEND OF THE FOLDER: %s\n", directory);
     
        closedir(dir);
     
        (void) sizeDir;
     
        return 0;
    }
    J'ai rajouter des trucs sympas (utiles pour l'utilisateur)

    J'ai compris : (dîtes moi si c'est pas ca)

    -chdir permet de remplacer current doc par le path fournit en paramètre

    Pas compris :

    -
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    La fonction getcwd() copie le chemin d'accès absolu du répertoire de travail courant dans la chaîne pointée par buf, qui est de longueur size.
    (Ca veut dire quoi en gros ?)

    -
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    if (strcmp(file->d_name, ".") && strcmp(file->d_name, ".."))
    -
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    struct dirent *file = NULL;
    Où puis-je trouver ce que contient dirent (je sais déjà ce que contient stat) ?

    Merci d'avance

  15. #115
    Expert éminent sénior
    Avatar de Emmanuel Delahaye
    Profil pro
    Retraité
    Inscrit en
    Décembre 2003
    Messages
    14 512
    Détails du profil
    Informations personnelles :
    Âge : 67
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Retraité

    Informations forums :
    Inscription : Décembre 2003
    Messages : 14 512
    Points : 20 985
    Points
    20 985
    Par défaut
    Citation Envoyé par _SamSoft_ Voir le message
    Où puis-je trouver ce que contient dirent (je sais déjà ce que contient stat) ?
    stat est public (le but est d'avoir des infos). dirent est opaque (sauf d_name). Tu n'auras pas d'infos supplémentaires.

    http://www.opengroup.org/onlinepubs/.../dirent.h.html
    Pas de Wi-Fi à la maison : CPL

  16. #116
    Membre averti Avatar de _SamSoft_
    Profil pro
    Étudiant
    Inscrit en
    Février 2007
    Messages
    798
    Détails du profil
    Informations personnelles :
    Âge : 32
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Février 2007
    Messages : 798
    Points : 345
    Points
    345
    Par défaut
    Entendu mais je cherche quels champs contient dirent

    Et pour l'autre question ?

  17. #117
    Expert éminent sénior
    Avatar de Emmanuel Delahaye
    Profil pro
    Retraité
    Inscrit en
    Décembre 2003
    Messages
    14 512
    Détails du profil
    Informations personnelles :
    Âge : 67
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Retraité

    Informations forums :
    Inscription : Décembre 2003
    Messages : 14 512
    Points : 20 985
    Points
    20 985
    Par défaut
    Citation Envoyé par _SamSoft_ Voir le message
    Entendu mais je cherche quels champs contient dirent
    Le seul champ connu, documenté et portable est d_name. Est-ce si difficile à comprendre ? Les autres dépendent de l'implémentation, autrement dit le programmeur n'y a pas accès et n'a pas à s'y intéresser.
    Pas de Wi-Fi à la maison : CPL

  18. #118
    Expert éminent sénior
    Avatar de Médinoc
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Septembre 2005
    Messages
    27 369
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Septembre 2005
    Messages : 27 369
    Points : 41 518
    Points
    41 518
    Par défaut
    getcwd() fait l'inverse de chdir() : chdir() permet de forcer le répertoire courant, getcwd() permet de le consulter.
    SVP, pas de questions techniques par MP. Surtout si je ne vous ai jamais parlé avant.

    "Aw, come on, who would be so stupid as to insert a cast to make an error go away without actually fixing the error?"
    Apparently everyone.
    -- Raymond Chen.
    Traduction obligatoire: "Oh, voyons, qui serait assez stupide pour mettre un cast pour faire disparaitre un message d'erreur sans vraiment corriger l'erreur?" - Apparemment, tout le monde. -- Raymond Chen.

  19. #119
    Membre averti Avatar de _SamSoft_
    Profil pro
    Étudiant
    Inscrit en
    Février 2007
    Messages
    798
    Détails du profil
    Informations personnelles :
    Âge : 32
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Février 2007
    Messages : 798
    Points : 345
    Points
    345
    Par défaut
    J'avais cru ("Ne crois pas, instruis toi", je sais -_- ) que vous parliez d'autre chose. Merci Emmanuel et Medinoc.

    Sinon pour ceci ? :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    if (strcmp(file->d_name, ".") && strcmp(file->d_name, ".."))
    En français : si(nom fichier = ".") et (nom fichier = "..")) alors
    Ca n'a pas de sens ?!

  20. #120
    Expert éminent

    Inscrit en
    Novembre 2005
    Messages
    5 145
    Détails du profil
    Informations forums :
    Inscription : Novembre 2005
    Messages : 5 145
    Points : 6 911
    Points
    6 911
    Par défaut
    Citation Envoyé par _SamSoft_ Voir le message
    J'avais cru ("Ne crois pas, instruis toi", je sais -_- ) que vous parliez d'autre chose. Merci Emmanuel et Medinoc.

    Sinon pour ceci ?
    La premiere chose a apprendre, c'est a lire les docs. Et la deuxieme a les trouver soi-meme. Poser des questions, c'est bien si on a d'abord essaye de se debrouiller tout seul.

    Comme tu n'es pas encore a la deuxieme etape et que tu t'interesses a POSIX: http://www.unix.org/version3. Regarde en particulier "Interface Tables" et "Read the online Single UNIX specification Version 3".
    Les MP ne sont pas là pour les questions techniques, les forums sont là pour ça.

+ Répondre à la discussion
Cette discussion est résolue.
Page 6 sur 7 PremièrePremière ... 234567 DernièreDernière

Discussions similaires

  1. Réponses: 0
    Dernier message: 24/05/2010, 13h56
  2. [Programmation]Faire du COM/OLE sous Linux ou équivalence
    Par randriano dans le forum Applications et environnements graphiques
    Réponses: 13
    Dernier message: 12/06/2008, 08h51
  3. Réponses: 3
    Dernier message: 14/08/2006, 22h08
  4. [EDI] Outil de programmation PHP équivalent à VSS
    Par bourvil dans le forum EDI, CMS, Outils, Scripts et API
    Réponses: 5
    Dernier message: 23/02/2006, 16h18

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo