0

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.

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by WaltP
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.