Converting an int to a char (C++)
Posted: Mon Feb 02, 2004 11:11 am
I am attempting to make descent.sng obsolete in D2X, and have most of the code for this done, but there is one problem: In checking for the game(level).mid files, I do the following:
<BLOCKQUOTE><font size="1" face="Arial">code:</font><HR><pre> j = 5;
while(j<10){
> if (cfexist(strcat("game0", strcat(i, ".mid")))){
sprintf(Songs[j] .filename, strcat("game0", strcat(i, ".mid")));
sprintf(Songs[j] .melodic_bank_file, "d2melod.bnk");
sprintf(Songs[j] .drum_bank_file, "d2drums.bnk");
j++;
} else {
break;
}
}
if (!(j<10)){
while(j>9){
if (cfexist(strcat("game", strcat(i, ".mid")))){
sprintf(Songs[j] .filename, strcat("game",strcat(i, ".mid")));
sprintf(Songs[j] .melodic_bank_file, "d2melod.bnk");
sprintf(Songs[j] .drum_bank_file, "d2drums.bnk");
j++;
} else {
break;
}
}
}
</pre><HR></BLOCKQUOTE>
The code compiles fine, but GPFs on the line with the >. Is there some way I can correct this?
And I do realize that there's a flaw in the implementation, where it will only check descent2.hog and not the loaded mission (this code is done at startup). This is not the problem I face, however, and I will correct that later.
(EDIT)What the hell, I thought UBB code wasn't supposed to trigger between
<BLOCKQUOTE><font size="1" face="Arial">code:</font><HR><pre> j = 5;
while(j<10){
> if (cfexist(strcat("game0", strcat(i, ".mid")))){
sprintf(Songs[j] .filename, strcat("game0", strcat(i, ".mid")));
sprintf(Songs[j] .melodic_bank_file, "d2melod.bnk");
sprintf(Songs[j] .drum_bank_file, "d2drums.bnk");
j++;
} else {
break;
}
}
if (!(j<10)){
while(j>9){
if (cfexist(strcat("game", strcat(i, ".mid")))){
sprintf(Songs[j] .filename, strcat("game",strcat(i, ".mid")));
sprintf(Songs[j] .melodic_bank_file, "d2melod.bnk");
sprintf(Songs[j] .drum_bank_file, "d2drums.bnk");
j++;
} else {
break;
}
}
}
</pre><HR></BLOCKQUOTE>
The code compiles fine, but GPFs on the line with the >. Is there some way I can correct this?
And I do realize that there's a flaw in the implementation, where it will only check descent2.hog and not the loaded mission (this code is done at startup). This is not the problem I face, however, and I will correct that later.
(EDIT)What the hell, I thought UBB code wasn't supposed to trigger between
Code: Select all
tags? All i instances changed to j to dodge this.