Problems creating custom txt names in C : I am having trouble creating custom filenames in C. The goal is to use custom files to print data to for separate entities. My current code for the printing to the file is:

```
void output(int t, double rx[], double ry[], double rz[], double vx[], double vy[], double vz[], double fx[], double fy[], double fz[])
{
	for(int i = 0; i < Npart; i++)
	{
		char name[20];
		sprintf(name, "Part_%d.txt", i);
		fptr = fopen(name, "a");
    	fprintf(fptr, "%4d, %10.2e, %10.2e, %10.2e, %10.2e, %10.2e, %10.2e, %10.2e, %10.2e, %10.2e\n", t, rx[i], ry[i], rz[i], vx[i], vy[i], vz[i], fx[i], fy[i], fz[i]);   
	}
}
```

The fptr has been initialised using *FILE. 
In this code Npart is currently only 2 entities (its set to 2 by a #define), but will be a lot bigger once I progress the program. Sadly when running this code it seems to work for low numbers of outputs, until 464 per file to be exact. 

After that I get the following error message:
```
timestep made, time is  463
Segmentation fault (core dumped)
```

When removing the output functionality and running the code without it no problems occur. Is there any clear mistake I have made in this code?