Hi,
I've uploaded the files to pastebin.com
dtio.h (
http://pastebin.com/m3cbd209a)
dtio.c (
http://pastebin.com/mcea9743)
a2test.c (
http://pastebin.com/m6e249679)
I'm trying to program a line editor but I've run into a problem that I'm totally stuck on.
a2test.c is the test main that I have to pass. My program fails when I follow the instructions on this line...
Press Delete Twice, 7, 8, 9, Enter
When I press the key 9 I get a heap error. I've narrowed the problem down to the for loop block starting at line 397 in dtio.c
I've even managed to solve the problem by making the following change on line 397...
for (i = linePos; i < strlen(theLine) - 2; i++){
but when I do that (above) something else in the test main fails. This time when I follow the instructions...
Press End, Backspace Twice, 1, 2, 3, Enter
the string is not correct.
Now my problem is I can't figure out a way to make both of those instructions to give me the correct results...
Press End, Backspace Twice, 1, 2, 3, Enter
Press Delete Twice, 7, 8, 9, Enter
I've tried various things but I just can't figure it out. If someone could have a look and point me in the right direction I would really appreciate it.
Thanks