Пример #1
0
void main(){
	//ouverture 
	int fd ;
	fd = open("/home/marms/Documents/ASR/C/TP5/x.mp3", O_CREAT |  O_RDONLY, 0666 );
    if( fd == -1 ){
    	printf("erreur ouverture\n");
    	exit(15);
    }	
	
  	printf("\n====ESSAIS PERMUTE======\n");
	  
	  	u16 *x= (u16*)malloc(sizeof(u16)); 
	  	*x=0x4244;//BD
	 	affiche_u16(x);
		permut2(x); //DB 
		affiche_u16(x);
		printf("x, %0x\n",*x);

		u32* g= (u32*)malloc(sizeof(u32));
		*g=0x10203040;
		permut4(g);			
	 	printf("g, %0x\n",*g);
	printf("\n======FIN PERMUTE=======\n");
  
	u8* a = (u8*) malloc(sizeof(u8));
	if(! read_u8(fd,a)){ printf("echec3\n");}
	affiche_u8(a);


	u16* e = (u16*) malloc(sizeof(u16));
	if(! read_u16(fd,e)){ printf("echec3\n");}
	affiche_u16(e);
	
	u32* f = (u32*) malloc(sizeof(u32));
	if(! read_u32(fd,f)){ printf("echec4\n");}
	affiche_u32(f);	



		*h = 0x6d776e6e ; 
		affiche_u32(h);
		aff_bin((u8*)h);	 printf("\n"); 
	    *h=	convert_size(*h);
		aff_bin((u8*)h); printf("\n"); 
	//fermeture
    close(fd);
}
Пример #2
0
int	auto_completation(char buf[3], char **cmd, int *i, t_data *data)
{
	int		ret;
	int		nbr_words;
	char	*cmd_bloc;

	(void)buf;
	cmd_bloc = gimme_last_cmd_bloc(*cmd);
	nbr_words = gimme_nbr_words(cmd_bloc);
	cmd_bloc = gimme_last_word(cmd_bloc);
	if (nbr_words == 0)
		ret = aff_current_directory();
	else if (nbr_words == 1)
		ret = aff_bin(cmd_bloc, data);
	else
		ret = aff_path(cmd_bloc);
	aff_prompt();
	ft_putstr(*cmd, 1);
	*i = ft_strlen(*cmd) + 1;
	return (ret);
}