[C言語]MIDI

MIDIとはMusical Instrument Digital Interface, 電子機器の演奏データを機器間で転送・共有するための共通規格


ん? なんだこれは?

#include 
#include 

typedef struct {   // typedefはtype definition 構造体
	char type[4];
	int size; // トラックチャンクデータのサイズ[4byte]
	char *data;
} TrackChunk;

short mergeChar7bit(char x, char y){
	short s;
	s = (unsigned char)x;
	s <<= 7;
	s = (s |(unsigned char)(y & 0x7f));
	return s;
}

int convertEndian(void *input, size_t s){
	int i;
	char *temp;

	if((temp = (char *)calloc(s, sizeof(char))) == NULL){
		perror("Error: Cannot get money for temp.");
		return 0;
	}

	for(i=0; i

$ gcc -o main main.c
main.c: In function ‘main’:
main.c:64:3: warning: implicit declaration of function ‘eperror’; did you mean ‘perror’? [-Wimplicit-function-declaration]
eperror("Error:Cannot open the file.");
^~~~~~~
perror
main.c:147:5: error: ‘jLL’ undeclared (first use in this function); did you mean ‘NULL’?
jLL;
^~~
NULL
main.c:147:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:317:13: warning: too many arguments for format [-Wformat-extra-args]
printf(")=%d",c,(unsigned char)track_chunks[i].data[j]);
^~~~~~
main.c:319:12: warning: zero-length gnu_printf format string [-Wformat-zero-length]
printf("");
^~
main.c:334:15: error: ‘statu’ undeclared (first use in this function); did you mean ‘status’?
} else if((statu & 0xf0) == 0xf0){
^~~~~
status
main.c:335:5: warning: implicit declaration of function ‘swtich’ [-Wimplicit-function-declaration]
swtich(status & 0x0f){
^~~~~~
main.c:335:26: error: expected ‘;’ before ‘{’ token
swtich(status & 0x0f){
^
main.c:573:22: error: invalid suffix "O" on integer constant
switch(cnt & 0xCO){
^~~~
main.c:645:11: warning: zero-length gnu_printf format string [-Wformat-zero-length]
printf("");

..$ gcc -o main main.c
main.c: In function ‘main’:
main.c:64:3: warning: implicit declaration of function ‘eperror’; did you mean ‘perror’? [-Wimplicit-function-declaration]
eperror("Error:Cannot open the file.");
^~~~~~~
perror
main.c:147:5: error: ‘jLL’ undeclared (first use in this function); did you mean ‘NULL’?
jLL;
^~~
NULL
main.c:147:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:317:13: warning: too many arguments for format [-Wformat-extra-args]
printf(")=%d",c,(unsigned char)track_chunks[i].data[j]);
^~~~~~
main.c:319:12: warning: zero-length gnu_printf format string [-Wformat-zero-length]
printf("");
^~
main.c:334:15: error: ‘statu’ undeclared (first use in this function); did you mean ‘status’?
} else if((statu & 0xf0) == 0xf0){
^~~~~
status
main.c:335:5: warning: implicit declaration of function ‘swtich’ [-Wimplicit-function-declaration]
swtich(status & 0x0f){
^~~~~~
main.c:335:26: error: expected ‘;’ before ‘{’ token
swtich(status & 0x0f){
^
main.c:573:22: error: invalid suffix "O" on integer constant
switch(cnt & 0xCO){
^~~~
main.c:645:11: warning: zero-length gnu_printf format string [-Wformat-zero-length]
printf("");