Dagnir El Che vive | C'est brouillon, curieusement ca marche pas sur tous les dossiers (   ) mais il est tard, j'ai pas mieux.
  Code :
 - // FolderList.cpp : Defines the entry point for the console application.
 - //
 - #include "stdafx.h"
 - #include <stdio.h>
 - #include <stdlib.h>
 - #include <windows.h>
 - #include <string.h>
 - typedef const wchar_t* LPCWSTR;
 - LPWSTR path = (LPWSTR)L"E:\\Dagnir\\Music";
 - // Prototype de la fonction  
 - void RechArborescence(LPWSTR , int );
 - //____________________Programme principal___________________________________  
 - int main(int argc, char *argv[])
 - {
 - // Déclaration des variables       
 - HANDLE hfind;
 - WIN32_FIND_DATA wfd;
 - int alinea = 1; //pour la mise en page
 - hfind = FindFirstFile(path, &wfd); // Répertoire racine  
 - wprintf(L"%s\n\n", wfd.cFileName);
 - RechArborescence(path, alinea);
 -  
 - system("PAUSE" );
 - return 0;
 - }
 - //______________Définition de la fonction________________________________  
 - void RechArborescence(LPWSTR path, int n)
 - {
 - 	WCHAR dir[256];
 - 	wsprintf(dir, path);
 - 	LPWSTR ant = (LPWSTR)L"\\*.*";
 - 	wcscat_s(dir, ant);
 - 	WIN32_FIND_DATA wfd;
 - 	HANDLE hfind = FindFirstFile(dir, &wfd);
 -  
 - 	while (FindNextFile(hfind, &wfd))
 - 	{
 -   if (wfd.cFileName[0] != '.')
 -   {
 -   	for(int k=0; k<n; k++) printf("\t" );
 -   	wprintf(L"%s\n", wfd.cFileName);
 -   	// vérifie si c'est un répertoire ou non  
 -   	if ( wfd.dwFileAttributes == 8208 )
 -   	{
 -     // c'est la qu'on introduit notre récursivité
 -     wsprintf(dir, L"%s\\%s", path, wfd.cFileName);
 -     RechArborescence(dir, n+1);
 -   	}       
 -         }
 -     }
 - 	// Recherche terminer, ferme la recherche  
 - 	FindClose(hfind);
 - }
 
  |  
 
   Ca sort un semblant d'arborescence.    ---------------
			 Nous vous souhaitons de beaux rêves, c'est le cinéma gratuit.
    |