Concatenate path and variable in C
===

this is my code.I need create 10 files with this format :
0.txt
1.txt
...

But i cant do it , the result is different.Anyone can help me?


'
    #include <stdlib.h>
    #include <string.h>
    
    
    char* direccion(char *dirD,int number){
    	char buffer[100];
    	char *n;
    	char *q;
    	char* formato=".txt";
    	
    	sprintf(buffer, "%i", number);
    	n= strcat(dirD,buffer);
    	q= strcat(n,formato);
    	
    	return q;
    
    }
    int main(){
    	int u;
    	int number= 0;
    	int t= 0;
    	char* q = "e:/c9/";
    	for(t=0; t< 10 ; t++){
    		
    		char* dir = direccion(q,number);
    		
    			if(fopen(dir,"w")){
    				fopen(dir,"w");
    				u=1;
    			}
    			else{
    				u=0;
    				printf("Error\n");
    			}
    		number++;
    	    
    	}
    	return 0;
    }'

Thanks !
