My program won't allow me to output these values because the "type name is not allowed" (highlighted in asterisks). What does that mean? What's wrong? I'm trying to parse this MIDI file, and it seems I need to use these data types, as the program was outputting the incorrect values (only MThd was outputting correctly, the rest were random hex values). What can I do to fix this? I'm new to coding, so sorry if this is a stupid question.
#include <iostream>
#include <fstream>
#include <stdint.h>
typedef struct MIDI_CHUNK_HEADER {
char MThd[4];
typedef uint32_t ChunckSize[4];
typedef uint16_t Format[2];
typedef uint16_t Track[2];
typedef uint16_t TimeDivision[2];
} MIDI_CHUNK_HEADER;
int main()
{
std::ifstream In_File("C:\\Users\\micah\\Documents\\Twinkle.mid", std::ios::binary | std::ios::in);
if (!In_File)
{
std::cerr << "Problem opening file!";
return 1;
}
MIDI_CHUNK_HEADER midi_chunk_header;
In_File.read((char*)&midi_chunk_header, sizeof(MIDI_CHUNK_HEADER));
std::cout << "File type is: "<< midi_chunk_header.**MThd** << std::endl;
std::cout << "Bytes to follow: " << midi_chunk_header.**ChunckSize** << std::endl;
std::cout << "MIDI Format: " << midi_chunk_header.**Format** << std::endl;
std::cout << "MIDI Track: " << midi_chunk_header.**Track** << std::endl;
std::cout << "MIDI Time Division: " << midi_chunk_header.**TimeDivision** << std::endl;
}