iam trying to use only one function to get the value of add and sub. if there is a label i want to ignore it.
file.txt
------------------------
label: add $1,$2,$2
sub $1,$2,$2
-----------------------
int main()
{
char line2[20];
char tem_line2[20];
char *tptr;
while(fget...line2) //read one line and store in char line2[20];
{
strcpy(tem_line2, line2); //store same value in different array
if(strstr(line2,":") == 0) //if there is a label, ignore 1st word
{
tptr = strtok(line2, " \t\n");
if(tptr != NULL)
{
funct1(line2);
}
}
else //if there is no label than dont ignore 1st word
{
funt1(line2);
}
}
}
funct1(char line2[])
{
char *tem_tptr;
tem_tptr = strtok(line2, " \t\n"); //here i should have value add, or sub
if(tem_tptr != NULL)
{
}
}
hwoarang69 11 Newbie Poster
histrungalot 32 Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.