S.O.S

#include <stdio.h>
#include <stdlib.h>
void main()
{
const int n = 2;
int i;
FILE *Fout[n];
char namafile[50];

for (i=1 ; i<=n ; i++)
{
printf("%d\n", i);
sprintf (namafile, "c:\\OS\\Result %d.txt", i);
Fout[i] = fopen(namafile, "w");
}
for (i=1;i<=n;i++)
{
fprintf(Fout[i], "test %d\n", i);
fclose(Fout[i]);
}
system("pause");
}



how can I remove the const?
Your title is totally unacceptable. Use a more proper defined one next time, one which defines your problem more specificaly.

Anyway why do you need to remove const? It needs to be const so as to be acceptable by the compiler.

If you just want at runtime to be able to control the number of files opened you can do it indirectly (this works in my c++ compiler I hope also in your C code)

1
2
3
int N;
scanf("%d",&N);
const int n = N;
Topic archived. No new replies allowed.