I have a snip of the following code which should read the first 4 objects in a .wav file in order to eventually parse the header of the file. I know I'm doing something wrong here because the buffer always passes "RIFF" without printing out Riff is found
How should I use the Switch-case in order to find the correct array characters?
#include <iostream>
#include <string>
using namespace std;
int main()
{
cout << "Nom: ";
string filename;
cout << "First Input filename:" << endl;
cin >> filename;
#pragma warning (disable : 4996)
FILE* InFile = fopen(filename.c_str(), "rb"); // Open wave file in read mode
char Buffer[4];
while (InFile) {
fread(Buffer, sizeof Buffer[0], 4, InFile);
switch (Buffer[4]) {
case 'R' +'I'+'F'+'F':
cout << "Riff is found " << endl;
case 'c' +'r'+ 'i'+ 'f' :
cout << "CRiff is found " << endl;
}
}
}