εχω γραψει αυτον τον κωδικα και ενω περιμενω να δημιουργησει τα αρχεια , δεν το κανει (ευχαριστω οποιον/α το ριξει μια ματια :D)
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define BUFFER_SIZE 4096
int main()
{
char str1[]=".txt", str0[100];
FILE *pf;
char **strings;
int i, total=0;
printf("Enter the number of strings : ");
scanf("%i",&total);
strings= malloc(total *sizeof(char *));
char buffer[BUFFER_SIZE];
int length =0;
while(getchar() != "\n"){
printf("\n");
for( i=0; i<total; i++){
printf("Enter string %i:",i+1);
fgets(buffer,BUFFER_SIZE,stdin);
length=strlen(buffer);
buffer[length-1]='\0';
strings=malloc(length *sizeof(char));
strcpy(strings,buffer);
strcat(strings,str1);
pf=fopen(str0,"w");
if(pf==NULL){
printf("unable to open the file \n");
}else{
fclose(pf);
}
}
printf("\n Resulting strings array\n");
for(i=0; i<total; i++){
printf("strings[%i]=%s\n",i,strings);
}
printf("\n");
}
return 0;
}