Skip to content

Commit

Permalink
Merge pull request #69 from algosup/55-export-to-bin-error
Browse files Browse the repository at this point in the history
55 export to bin error
  • Loading branch information
MaximeAlgosup authored Feb 22, 2024
2 parents b7a89c0 + 5e8468f commit 20f1610
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/binExporter.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ void exportToBin(instList_t *nodeList, char *filename, varList_t *varList, asm_e
} else {
// write the argument
if(node->arg0 != NULL){
fwrite(stringToBinary(node->arg0, errData), 1, strlen(node->arg0) * 8, file);
fwrite(stringToBinary(node->arg0, errData), 1, sizeof(char)* 8, file);
}
else if(node->arg1 != NULL){
fwrite(stringToBinary(node->arg1, errData), 1, strlen(node->arg1) * 8, file);
fwrite(stringToBinary(node->arg1, errData), 1, sizeof(char)* 8, file);
}
else {
fwrite("00000000", 1, 8, file);
Expand Down Expand Up @@ -204,7 +204,7 @@ char *stringToBinary(char *s, asm_error_t *errData) {
for (int i = 7; i >= 0; i--) {
bin[i] = (num >> (7 - i)) & 1 ? '1' : '0';
}
bin[8] = '\0'; //
bin[8] = '\0';
return bin;
} else {
// Convert char to byte
Expand Down

0 comments on commit 20f1610

Please sign in to comment.