A
Aris
A few days ago I asked from you how to join a string like "file"
A number that change values from 1 to 5 and another string like ".txt"
to have a result like "file1.txt","file2.txt" and so on
and you gave me the right answer.
But now I got another problem.
How can I save that values to an array?
This is the code you gave me:
void CreateName(char *dest_fname, const char *fname, const char *ext, int
counter,int *a,int length)
{
sprintf(dest_fname, "%s%d%s", fname, counter, ext);
Write_File(dest_fname,a,length);
}
int main()
{
int *A;
char *B[5]; //I tried this
char fname[] = "file";
char ext[] = ".txt";
char out[64] = {'\0'};
int file_counter=0,k=0;
for(int i=20000; i<=100000; i+=20000)
{
A=Create_RundomNumbers_Array(i);
CreateName(out, fname, ext, ++file_counter,A,i);
B[k++]=out; //and this
}
But it doesn't work.
strcpy(B[k++],out); doesn't work.either.
what can I do?
A number that change values from 1 to 5 and another string like ".txt"
to have a result like "file1.txt","file2.txt" and so on
and you gave me the right answer.
But now I got another problem.
How can I save that values to an array?
This is the code you gave me:
void CreateName(char *dest_fname, const char *fname, const char *ext, int
counter,int *a,int length)
{
sprintf(dest_fname, "%s%d%s", fname, counter, ext);
Write_File(dest_fname,a,length);
}
int main()
{
int *A;
char *B[5]; //I tried this
char fname[] = "file";
char ext[] = ".txt";
char out[64] = {'\0'};
int file_counter=0,k=0;
for(int i=20000; i<=100000; i+=20000)
{
A=Create_RundomNumbers_Array(i);
CreateName(out, fname, ext, ++file_counter,A,i);
B[k++]=out; //and this
}
But it doesn't work.
strcpy(B[k++],out); doesn't work.either.
what can I do?