This is a small portion of my code:
char *a; asprintf(&a,"%%%ds",Max_FnLen); printf(a,files[i-1]->d_name); free(a); printf("%s",KNRM); if ( (i % (180/Max_FnLen)) == 0) printf("\n"); Its running fine but I want to left align the output but it is coming right aligned by default can anyone help me with this.
printf("%.*s", len, str). The*specifies a variable in the argument list is to be used for the width (or precission).