Hi guys, this is my first post!
I like programming C and I like to find here a lot of friends!
I've done a program that read a midi file and from its hex code, program obtains feature (tracks,formats,instrument...).
Now I've got a problem with fread().
If hex code is 4D54, my program set (so read) in array: 544D and so print: "Print fread: 544D". I need my program reads correct code and not contrary.Code:#include <stdio.h> main() { int n,i; FILE *fp; short int data[10]; fp = fopen("formato.mid","r"); if (fp!=NULL) { fread(data,2,10,fp); for (i=0;i<10;i++) { printf("Print fread buf: %x\n",data[i]); } } fclose(fp); }
Do you know how could I solve it and why happens?
Thanks!!!



LinkBack URL
About LinkBacks




