Skip to content

Commit 2899a46

Browse files
there were two problems, not one. Previous commit fixed not writing in binary. This time I just resized an array because extra goop got tacked on to a char array.
1 parent 2fcfa97 commit 2899a46

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -204,15 +204,15 @@ void editmedals(string filename){
204204

205205
if (writeFile.is_open())
206206
{
207-
char *b = (char*)malloc(18 * sizeof(char));
207+
char b[18];
208208

209209
for (int j = 0; j < 9; j++) {
210210
b[j * 2] = (char)(umed[j] & 0xFF);
211211
b[j * 2 + 1] = (char)(umed[j] >> 8);
212212
}
213213

214214
string newMedals(b);
215-
215+
newMedals.resize(18);
216216
string newData = p1 + newMedals + p3;
217217

218218
writeFile << newData;

0 commit comments

Comments
 (0)