Not use system()... but how?

Pages: 12
Make your own program to interrupt the graphics card for an instant.
@legit: it only works if u have a blank screen if ur in the middle of the screen then it will be blank with the command line in the middle of the screen
@Westonrwright
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?
http://www.google.com/search?btnI=1&q=msdn+Clearing+The+Screen

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:
http://www.cplusplus.com/forum/beginner/83710/#msg449736

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.

@Aramil Legit's method works for any screen with fewer than 58 lines, and it is one of the methods mentioned in my article.
http://www.cplusplus.com/articles/4z18T05o/#TheStandardWay
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.
@Westonwright,
I used your method. Thanks guys! I was able to pause, name the console title, and clear the screen! But if you could help me with a bunch of other sutff!
My Motto:
1
2
3
4
5
6
if (system() == evil)
     cout << "The world is safe!";

else
     cout << "DESTROY THE UNIVERSE.";
Last edited on
So can anyone help me on the rest?
Please?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <lazymethod.h>
#include <hardway.h>
#include <iostream>

using namespace std;

//class codehabit goes here (could get complex, as our jobs are almost never 
//easy)

int main()
{
      codehabit c;
      if (lazymethod.is_dangerous()) c.codehabit(hardway.do_this());
      else c.codehabit(lazymethod.do_this());
      return 0;
} //end main 
Last edited on
...
Topic archived. No new replies allowed.
Pages: 12