
 Envoyé par 
grocko_t
					
				 
				
	
	1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
   |  
  if ((S_IFMT & recupstat->st_mode) == S_IFREG)
    printf("-");
  else if ((S_IFMT & recupstat->st_mode) == S_IFDIR)
    printf("d");
  else if ((S_IFMT & recupstat->st_mode) == S_IFCHR)
    printf("c");
  else if ((S_IFMT & recupstat->st_mode) == S_IFBLK)
    printf("b");
  else if ((S_IFMT & recupstat->st_mode) == S_IFIFO)
    printf("p");
  else if ((S_IFMT & recupstat->st_mode) == S_IFLNK)
    printf("l");
  else if ((S_IFMT & recupstat->st_mode) == S_IFSOCK)
    printf("s");
  else
  printf("?"); | 
  
			
		 
	 
 Salut
Pourquoi tu n'utilises pas les macro S_ISDIR(), S_ISREG(), S_ISFIFO(), ... dédiées à ce travail ???
	
		
			
			
				
					
 Envoyé par 
grocko_t
					
				 
				
	
	  ((recupstat->st_mode & S_IRUSR) == S_IRUSR) ? printf("r") : printf("-")
  
			
		 
	 
 
	
	printf("%c",  ((recupstat->st_mode & S_IRUSR) == S_IRUSR) ?"r" :"-")
 
 
	
		
			
			
				
					
 Envoyé par 
grocko_t
					
				 
				
	
	1 2 3 4 5
   | void            recup(char *name)
{
  struct stat           *recup_stat;
 
  stat(name, recup_stat); | 
  
			
		 
	 
 Ouais !!! Et vas-y que je stocke des données dans un pointeur non alloué...
						
					
Partager