0

I'm having an issue with my program when taking in a string.

I have two variables (ones for testing), char xpr[50] and char tst[50].
xpr gets it string by fgets --- fgets(xpr,50, stdin);
tst gets it value by strcpy --- strcpy(tst, "((1 + (2 * 3))*(2*3))");

when prompt, I put the same value ((1 + (2 * 3))*(2*3)) in xpr.

The problem is that the strcmp(xpr,tst) is greater than 0 instead of equal to 0.

Any ideas?

Edited by BLUEC0RE: n/a

2
Contributors
2
Replies
4
Views
7 Years
Discussion Span
Last Post by BLUEC0RE
0

I think you might be on to something. I did a loop through all the characters and when it hit the last character, it jumped to the next line. I guess I gotta trim it out.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.