I have to make a 'C' program that takes a set of decimal numbers that are stored in an input file, and then convert the decimal numbers to binary, and then store those conversions into the output file.
I have the program done that reads the input file and stores it in the output file, but I dont know what I need to add in order to convert the decimal numbers.
Here is what I have:
Code:
#include<stdio.h>
#include<string.h>
int main()
{
FILE *input,*output;
char littleman[8];
int k;
input = fopen("LMC.s","r");
output = fopen("LMC.o","w");
while(fscanf(input, "%s%s",opcode,address)!=EOF)
{
fprintf(output,"Opcode: %s \t\tAddress: %s\n",opcode,address);
}
fclose(output);
fclose(input);
return 0;
}
any help would be great. thanks