Hello,
I would like to know how to read multiple files without using DIR. For example, program will search ".bin" file and create a new variable for the file. But the exception is my compiler does not know the directory (like opendir or readdir). I am doing dsp programming. I know for single file. Here is the single file code:
char* fileTestImage = "sample.bin";
FILE *readTestImage;
//Open file
readTestImage = fopen(fileTestImage, "rb");
if (!readTestImage)
{
fprintf(stderr, "Unable to open file %s", fileTestImage);
return 0;
}
else
{ //ReadFile
int readItems = fread(testImage, sizeof(unsigned char), IMAGE_SIZE, readTestImage);
fprintf(stdout, "Read Items in %s is: ", fileTestImage);
printf("%d\n", readItems);
//close the file
fclose(readTestImage);
}
I want to make it for multiple files and file name get by searching folder. Again I am not allowed to use DIR.
Thanks in advance for any help.