Clear display

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Maxd out

    Clear display

    Hi

    I'm wondering if you can clear a monitor display cout that asks for
    something after it's been read in by cin e.g;
    cout <<"Enter number" <<endl;
    If so how can it be done?


  • Thomas Matthews

    #2
    Re: Clear display

    Maxd out wrote:
    [color=blue]
    > Hi
    >
    > I'm wondering if you can clear a monitor display cout that asks for
    > something after it's been read in by cin e.g;
    > cout <<"Enter number" <<endl;
    > If so how can it be done?
    >
    >[/color]

    Clearing the screen is a platform specific issue since many platforms
    do not support screens. Read the FAQ and welcome.txt below for
    more assistance with screen clearing.

    --
    Thomas Matthews

    C++ newsgroup welcome message:

    C++ Faq: http://www.parashift.com/c++-faq-lite
    C Faq: http://www.eskimo.com/~scs/c-faq/top.html
    alt.comp.lang.l earn.c-c++ faq:

    Other sites:
    http://www.josuttis.com -- C++ STL Library book

    Comment

    • torhu

      #3
      Re: Clear display

      "Maxd out" <nicolla.macphe rson@bigpond.co m> wrote in message news:<oS%2b.663 61$bo1.11407@ne ws-server.bigpond. net.au>...[color=blue]
      > Hi
      >
      > I'm wondering if you can clear a monitor display cout that asks for
      > something after it's been read in by cin e.g;
      > cout <<"Enter number" <<endl;
      > If so how can it be done?[/color]

      Do you mean outputting something and then clearing the screen?
      On DOS/Windows you could probably just do this:

      #include<cstdli b>
      system("command /c cls");

      This is equivalent to typing 'cls' on the command line. Since cls is
      a command that is built-in (internal) to command.com, you can't just
      say system("cls"). This is because system() needs a real program file
      to execute, it can't 'type' commands on the command line like you can
      do yourself. :)

      If you're on a Linux/Unix system, I think there's a similar solution
      there.

      Hope I didn't answer the wrong question!

      Comment

      • Dave O'Hearn

        #4
        Re: Clear display

        "Maxd out" <nicolla.macphe rson@bigpond.co m> wrote:[color=blue]
        > I'm wondering if you can clear a monitor display cout that asks for
        > something after it's been read in by cin e.g;
        > cout <<"Enter number" <<endl;
        > If so how can it be done?[/color]

        By clear the display, do you mean wipe the screen clean and start over
        at the top line? Or are you talking about something inside of
        iostreams, clearing buffers?

        For clearing the display like I guessed, that can't be done with
        Standard C++ alone. If it's a VT100 terminal, you could send
        "\033[H\033[J", which tends to work... but if that doesn't work, or
        you want to know more about terminal control, you'll have to look for
        a spec, library, or group on ansi terminals, since they aren't part of
        standard C++.

        --
        Dave O'Hearn

        Comment

        • Maxd out

          #5
          Re: Clear display

          Thank you all for your input, it's given me a lot to think about.
          The cls for clear screen sounds logical, but i will also goto the suggested
          sites to learn more and try all suggestions.
          Thanks again


          "Dave O'Hearn" <daveoh77@pobox .com> wrote in message
          news:3e05f9e4.0 308270752.68a95 98c@posting.goo gle.com...[color=blue]
          > "Maxd out" <nicolla.macphe rson@bigpond.co m> wrote:[color=green]
          > > I'm wondering if you can clear a monitor display cout that asks for
          > > something after it's been read in by cin e.g;
          > > cout <<"Enter number" <<endl;
          > > If so how can it be done?[/color]
          >
          > By clear the display, do you mean wipe the screen clean and start over
          > at the top line? Or are you talking about something inside of
          > iostreams, clearing buffers?
          >
          > For clearing the display like I guessed, that can't be done with
          > Standard C++ alone. If it's a VT100 terminal, you could send
          > "\033[H\033[J", which tends to work... but if that doesn't work, or
          > you want to know more about terminal control, you'll have to look for
          > a spec, library, or group on ansi terminals, since they aren't part of
          > standard C++.
          >
          > --
          > Dave O'Hearn[/color]


          Comment

          • Thomas Matthews

            #6
            Re: Clear display

            torhu wrote:[color=blue]
            > "Maxd out" <nicolla.macphe rson@bigpond.co m> wrote in message news:<oS%2b.663 61$bo1.11407@ne ws-server.bigpond. net.au>...
            >[color=green]
            >>Hi
            >>
            >>I'm wondering if you can clear a monitor display cout that asks for
            >>something after it's been read in by cin e.g;
            >>cout <<"Enter number" <<endl;
            >> If so how can it be done?[/color]
            >
            >
            > Do you mean outputting something and then clearing the screen?
            > On DOS/Windows you could probably just do this:
            >
            > #include<cstdli b>
            > system("command /c cls");
            >
            > This is equivalent to typing 'cls' on the command line. Since cls is
            > a command that is built-in (internal) to command.com, you can't just
            > say system("cls"). This is because system() needs a real program file
            > to execute, it can't 'type' commands on the command line like you can
            > do yourself. :)
            >
            > If you're on a Linux/Unix system, I think there's a similar solution
            > there.
            >
            > Hope I didn't answer the wrong question![/color]

            So, how do I clear the screen on an embbedded system for a laser
            printer?

            Is there a standard method to do this?

            Perhaps this is why people redirect these issues to the newsgroup
            dedicated to the platform.

            There are more platforms than just Windows, Linux, Unix, etc.

            --
            Thomas Matthews

            C++ newsgroup welcome message:

            C++ Faq: http://www.parashift.com/c++-faq-lite
            C Faq: http://www.eskimo.com/~scs/c-faq/top.html
            alt.comp.lang.l earn.c-c++ faq:

            Other sites:
            http://www.josuttis.com -- C++ STL Library book
            http://www.sgi.com/tech/stl -- Standard Template Library

            Comment

            • ArWeGod

              #7
              Re: Clear display

              "torhu" <thusaboe@hotma il.com> wrote in message
              news:25b320.030 8270734.6ea0088 8@posting.googl e.com...[color=blue][color=green]
              > > I'm wondering if you can clear a monitor display cout that asks for
              > > something after it's been read in by cin e.g;
              > > cout <<"Enter number" <<endl;
              > > If so how can it be done?[/color]
              >
              > Do you mean outputting something and then clearing the screen?
              > On DOS/Windows you could probably just do this:
              >
              > #include<cstdli b>
              > system("command /c cls");
              >
              > This is equivalent to typing 'cls' on the command line.[/color]

              Oh, please. How about something a little nicer:

              =============== ===========
              // CLS.C

              #include "dos.h"

              void main (void)
              {
              union _REGS inregs, outregs;

              inregs.x.cx = 0x00; // upper left corner
              inregs.x.dx = 0x2479; // lower right corner
              inregs.h.bh = 0x07; // screen attribute
              inregs.x.ax = 0x0600; // BIOS interrupt
              _int86 (0x10, &inregs, &outregs);

              }

              =============== ===========

              -
              ArWeGod


              Comment

              Working...