I want to open different file names, at first it work well on couple files, but it has to be in order, what if i open random file like fall01, fall05,srping09 etc
Thanks
#include <stdio.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
#include <iostream>
int main() {
FILE *file;
int i;
char fileparam[16];
for(i =1; i<=10;i++)
{
if( sprintf (fileparam, "fall%d.dat", i) == true )
{
file = fopen(fileparam,"r");
}
if(file==NULL)
{
printf("Error: %s does not exist\n",fileparam);
printf("Error: can't open file.\n");system("pause");
}
else
{
printf("%s was opened successfully.\n", fileparam);
printf("Good\n");
system("pause");
}
}// done for
// the rest of process related to the file are trim
fclose(file);
return 0;
}