Okay, let's see.
As a rule of thumb, if you're using more than 4 variables that end with numbers, you probably need to use some sort of linear data structure (array, vector, list or whatever):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
char *tr1 = "/Desktop/project/Fensd.mfc";
char *tr2 = "/Desktop/project/Fensref.mfcc";
char *tr3 = "/Desktop/project/Lichref.mfcc";
char *tr4 = "/Desktop/project/Licharef.mfcc";
char *tr5 = "/Desktop/project/jaref.mfcc";
char *tr6 = "/Desktop/project/Neinref1.mfcc";
char *tr7 = "/Desktop/_project/Lictref2.mfcc";
char *tr8 = "/Desktop/project/Lichref3.mfcc";
char *tr9 = "/Desktop/project/Neinref2.mfcc";
//Wrong!
char *tr[]={
"/Desktop/project/Fensd.mfc",
"/Desktop/project/Fensref.mfcc",
"/Desktop/project/Lichref.mfcc",
"/Desktop/project/Licharef.mfcc",
"/Desktop/project/jaref.mfcc",
"/Desktop/project/Neinref1.mfcc",
"/Desktop/_project/Lictref2.mfcc",
"/Desktop/project/Lichref3.mfcc",
"/Desktop/project/Neinref2.mfcc",
};
//Right!
|
After you do that, the code will be much more scrutable.
What do you mean it gives you an error message? What kind of error message?
By the way, I'm pretty sure this like is problematic:
1 2
|
//What if there are less than sizeof(hdrstr) bytes in fp?
fread(&hdrs, 1, sizeof(hdrstr), fp);
|
This is also not a good idea:
system("/usr/local/bin/HCopy /Desktop/project/demo/Neintest.wav /Desktop/project/Neintest.mfc");
Avoid system() like the plague, except maybe in small test programs to save some time. If you need to do anything with the system you can't do with the standard library (in this case, you could write your own copy function, but it's usually a hassle), then prefer either some portable library (like boost) or use system calls