I have this in a code:
`
int load_snapshot(char *fname, int files)
{
FILE *fd;
char buf[200];
int i, j, k, dummy, ntot_withmasses;
int t, n, off, pc, pc_new, pc_sph;
#define SKIP fread(&dummy, sizeof(dummy), 1, fd);
for(i = 0, pc = 1; i < files; i++, pc = pc_new)
{
if(files > 1)
sprintf(buf, "%s.%d", fname, i);
else
sprintf(buf, "%s", fname);
if(!(fd = fopen(buf, "r")))
{
printf("can't open file `%s`\n", buf);
exit(0);
}
printf("reading `%s' ...\n", buf);
fflush(stdout);
fread(&dummy, sizeof(dummy), 1, fd);
fread(&header1, sizeof(header1), 1, fd);
fread(&dummy, sizeof(dummy), 1, fd);
And i don´t know why the program returns can't open file. I dn´t know how can I do to avoid fd = fopen(buf, "r")