Turn off the troll pride and learn something. Just saying it is not "not correct" because of an appeal to authority does not make it true. If you really want an appeal to authority, how about some entity that knows more about it than your CS professor? Like Microsoft?
I'm sorry your feelings are hurt, but that doesn't change the truth. You've already been shown where your professor's function is incorrect in the post immediately following mine:
One of the marks of a good computer programmer is learning to accept when he is wrong instead of just plowing forward with his version of reality. That has taken me some time to learn, and I'm not just trying to beat-up on you. Instead, I'm trying to share what I know to be correct
with as many people as possible, particularly when it touches on a particularly convoluted and tricky subject as terminal control. Part of that is discouraging incomplete solutions that rely upon the default compiler settings to work.
I've been told off for dumb stuff too, so you aren't alone there, and no one is suggesting you are stupid.
's method works for any screen with fewer than 58 lines, and it is one of the methods mentioned in my article.
My terminal has 74 lines. The example I gave in the article works for any terminal less than or equal to a hundred lines, which should cover almost all cases should you be forced to use that sub-optimal method.
He just needs to make sure to use the proper escape sequence (not '/n' but '\n') -- but that's OK. Every time I post without first testing I discover I made a significant typo or omission of some sort.