checking errors in the data of a text file
Hi I'm trying to make a program that opens a text file with assembly language reads the data and runs a error check on the data in the text file. For example say one line in the data has the op-code lda $600 when the correct op-code is meant to be ldaa $600 I want the program to be able to pick that error up.
I have already got a half of the program that opens the text file.
Code:
#include <stdio.h>#include <string.h>
int main(void)
{
FILE*fname;
char prompt;
char filename[15];
char text[100];
printf( "Please enter the name of the file you wish to open: \n" );
fgets(filename, sizeof(filename), stdin);
filename[strlen(filename)-1]='\0';
fname = fopen(filename, "r");
if (fname == NULL)
{
printf( "ERROR the file you have chosen cannot be opened \n" );
printf( "Please make sure the file exists \n");
}
while (fgets(text,100,fname) != NULL)
printf("\n%s", text);
scanf("\n%c",&prompt);
}
the assembly language is for a 68hc11 line assembler by the way
Thanks