Screen Editing

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

    Screen Editing

    I was just wondering if there is any way of editing anything already
    printed on the screen with out using the system("cls") command.

  • Christopher Benson-Manica

    #2
    Re: Screen Editing

    someone <randomuser5000 @gmail.comwrote :
    I was just wondering if there is any way of editing anything already
    printed on the screen with out using the system("cls") command.
    Not portably, since a standard-conformant implementation need not
    involve anything resembling a "screen". There are a number of choices
    available depending on your needs and platform, but none of them are
    topical here.

    --
    C. Benson Manica | I *should* know what I'm talking about - if I
    cbmanica(at)gma il.com | don't, I need to know. Flames welcome.

    Comment

    • Keith Thompson

      #3
      Re: Screen Editing

      "someone" <randomuser5000 @gmail.comwrite s:
      I was just wondering if there is any way of editing anything already
      printed on the screen with out using the system("cls") command.
      There is no portable way to do this.

      The comp.lang.c FAQ is at <http://www.c-faq.com/>. You have asked
      question 19.4.

      --
      Keith Thompson (The_Other_Keit h) kst-u@mib.org <http://www.ghoti.net/~kst>
      San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
      We must do something. This is something. Therefore, we must do this.

      Comment

      • Chen Shusheng

        #4
        Re: Screen Editing

        printf("\033[2J"); /* clear screen */
        printf("\033[%d;%dH", 10, 20); /* move cursor (row 10, col 20) */
        printf("Hello, ");
        printf("\033[7mworld\033[0m!"); /* inverse video */

        I tried upper commands. Seems does not work proper as the explanations.

        printf("\033[2J"); display"<-2j"
        ...........
        could anyone tell me his results?
        ------------------------------------------------------
        "Keith Thompson" <kst-u@mib.org?????? :ln8xlognww.fsf @nuthaus.mib.or g...
        "someone" <randomuser5000 @gmail.comwrite s:
        >I was just wondering if there is any way of editing anything already
        >printed on the screen with out using the system("cls") command.
        >
        There is no portable way to do this.
        >
        The comp.lang.c FAQ is at <http://www.c-faq.com/>. You have asked
        question 19.4.
        >
        --
        Keith Thompson (The_Other_Keit h) kst-u@mib.org
        <http://www.ghoti.net/~kst>
        San Diego Supercomputer Center <*>
        <http://users.sdsc.edu/~kst>
        We must do something. This is something. Therefore, we must do this.

        Comment

        • Nils O. SelÃ¥sdal

          #5
          Re: Screen Editing

          Chen Shusheng wrote:
          printf("\033[2J"); /* clear screen */
          printf("\033[%d;%dH", 10, 20); /* move cursor (row 10, col 20) */
          printf("Hello, ");
          printf("\033[7mworld\033[0m!"); /* inverse video */
          flush the output, stdout might be buffered.
          I tried upper commands. Seems does not work proper as the explanations.
          >
          printf("\033[2J"); display"<-2j"
          ..........
          could anyone tell me his results?
          Perhaps your output device doesn't understand these ansi escape
          codes, read its documentation.

          Comment

          • Ancient_Hacker

            #6
            Re: Screen Editing


            someone wrote:
            I was just wondering if there is any way of editing anything already
            printed on the screen with out using the system("cls") command.
            There is no "C" way to do this, as C precedes most CRT terminals,

            Even the few that existed back then cost about $3 to $15 THOUSAND
            dollars each, and each had its own quirky control sequence for clearing
            the screen. The first one I ever saw was in 1969, at a trade show,
            made by Univac, and cost $15,000, retail.



            and it's not clear terminal control falls under the baliwick of the C
            language or th standard C libraries..


            The most portable way is dorky, but works most every place I can think
            of:


            for( i=1; i <= 66 + 24 /* for those TALL full page displays,plus
            lagniappe */; i++ )
            puts( "\n" );


            If your intended terminal has some alleged "ANSI" control code
            capability, there's something gross, like puts( "\033;2J" ) that does
            the trick, google for "termcap vt100" or ANSI and see the "cl" entry.

            Comment

            • Andrew Smallshaw

              #7
              Re: Screen Editing

              On 2006-08-17, Ancient_Hacker <grg2@comcast.n etwrote:
              >
              The most portable way is dorky, but works most every place I can think
              of:
              >
              for( i=1; i <= 66 + 24 /* for those TALL full page displays,plus
              lagniappe */; i++ )
              puts( "\n" );
              >
              If your intended terminal has some alleged "ANSI" control code
              capability, there's something gross, like puts( "\033;2J" ) that does
              the trick, google for "termcap vt100" or ANSI and see the "cl" entry.
              Most terminals, particularly modern ones, will clear the screen if
              you simply send them a formfeed. It's not guaranteed, but it's a
              similar kind of assumption to backspace will move the cursor left
              which seems pretty much standard these days.

              I'd agree looking at the termcap manual would be a good idea, though,
              at least if the OP is talking about a serial terminal or an emulation
              of one.

              --
              Andrew Smallshaw
              andrews@sdf.lon estar.org

              Comment

              • Martin Ambuhl

                #8
                Re: Screen Editing

                Ancient_Hacker wrote:
                someone wrote:
                >I was just wondering if there is any way of editing anything already
                >printed on the screen with out using the system("cls") command.
                >
                There is no "C" way to do this, as C precedes most CRT terminals,
                Strange. Those CRT terminals that I was using regularly for more than
                10 years before C existed. In fact, the first PDP-1 of 1957 had a CRT
                display (which is iconized in the DECUS logo). I used plenty of VT05s
                and VT52s (the later are still 4 years before C). Even the ANSI
                standard X3.64 predates the publication of K&R1, although Heath's
                implementation and DEC's VT100 were not yet out at K&R1's publication date.

                Comment

                • Herbert Rosenau

                  #9
                  Re: Screen Editing

                  On Thu, 17 Aug 2006 00:33:37 UTC, "someone" <randomuser5000 @gmail.com>
                  wrote:
                  I was just wondering if there is any way of editing anything already
                  printed on the screen with out using the system("cls") command.
                  >
                  No, because C does know nothing about a screen, TTY, printer or other
                  devises. So you may ask in a group related to POSIX or to your OS to
                  get a solution beside standard C.

                  --
                  Tschau/Bye
                  Herbert

                  Visit http://www.ecomstation.de the home of german eComStation
                  eComStation 1.2 Deutsch ist da!

                  Comment

                  • Thomas Dickey

                    #10
                    Re: Screen Editing

                    Andrew Smallshaw <andrews@sdf.lo nestar.orgwrote :
                    Most terminals, particularly modern ones, will clear the screen if
                    you simply send them a formfeed. It's not guaranteed, but it's a
                    you're confused. Whether you've observed a particular terminal driver,
                    or a user application is probably irrelevant.

                    --
                    Thomas E. Dickey
                    Thomas Dickey develops/maintains widely-used tools and libraries for software development (diffstat, yacc, mawk) and terminals (ncurses, lynx, xterm)

                    ftp://invisible-island.net

                    Comment

                    • Tak-Shing Chan

                      #11
                      Re: Screen Editing

                      On Thu, 17 Aug 2006, Thomas Dickey wrote:
                      Andrew Smallshaw <andrews@sdf.lo nestar.orgwrote :
                      >
                      >Most terminals, particularly modern ones, will clear the screen if
                      >you simply send them a formfeed. It's not guaranteed, but it's a
                      >
                      you're confused. Whether you've observed a particular terminal driver,
                      or a user application is probably irrelevant.
                      I don't think Andrew is confused. I think you are.

                      Tak-Shing

                      Comment

                      • Tak-Shing Chan

                        #12
                        Re: Screen Editing

                        On Thu, 17 Aug 2006, Herbert Rosenau wrote:
                        On Thu, 17 Aug 2006 00:33:37 UTC, "someone" <randomuser5000 @gmail.com>
                        wrote:
                        >
                        >I was just wondering if there is any way of editing anything already
                        >printed on the screen with out using the system("cls") command.
                        >>
                        No, because C does know nothing about a screen, TTY, printer or other
                        devises. So you may ask in a group related to POSIX or to your OS to
                        get a solution beside standard C.
                        C does know about character display semantics (ISO 9899/1990
                        *and* 1999, 5.2.2), specifically backspaces ('\b'), form feeds
                        ('\f'), and carriage returns ('\r'). So yes, it is possible to
                        ``edit'' something already printed on a display device (however,
                        quality of implementation differs).

                        Tak-Shing

                        Comment

                        • Tak-Shing Chan

                          #13
                          Re: Screen Editing

                          On Thu, 17 Aug 2006, Ancient_Hacker wrote:
                          someone wrote:
                          >I was just wondering if there is any way of editing anything already
                          >printed on the screen with out using the system("cls") command.
                          >
                          There is no "C" way to do this, as C precedes most CRT terminals,
                          What about ISO 9899:1990, 5.2.2, where escape sequences for
                          display devices (such as '\f', '\b' and '\r') are defined? The
                          only problem with these are quality of implementation issues.

                          Tak-Shing

                          Comment

                          • Thomas Dickey

                            #14
                            Re: Screen Editing

                            Tak-Shing Chan <t.chan@gold.ac .ukwrote:
                            On Thu, 17 Aug 2006, Thomas Dickey wrote:
                            >Andrew Smallshaw <andrews@sdf.lo nestar.orgwrote :
                            >>
                            >>Most terminals, particularly modern ones, will clear the screen if
                            >>you simply send them a formfeed. It's not guaranteed, but it's a
                            >>
                            >you're confused. Whether you've observed a particular terminal driver,
                            >or a user application is probably irrelevant.
                            I don't think Andrew is confused. I think you are.
                            hmm. I have a list in mind. Which "modern" one clears the screen
                            when you send a form-feed to it?

                            --
                            Thomas E. Dickey
                            Thomas Dickey develops/maintains widely-used tools and libraries for software development (diffstat, yacc, mawk) and terminals (ncurses, lynx, xterm)

                            ftp://invisible-island.net

                            Comment

                            • Thomas Dickey

                              #15
                              Re: Screen Editing

                              Thomas Dickey <dickey@saltmin e.radix.netwrot e:
                              Tak-Shing Chan <t.chan@gold.ac .ukwrote:
                              >On Thu, 17 Aug 2006, Thomas Dickey wrote:
                              >>Andrew Smallshaw <andrews@sdf.lo nestar.orgwrote :
                              >>>
                              >>>Most terminals, particularly modern ones, will clear the screen if
                              >>>you simply send them a formfeed. It's not guaranteed, but it's a
                              >>>
                              >>you're confused. Whether you've observed a particular terminal driver,
                              >>or a user application is probably irrelevant.
                              > I don't think Andrew is confused. I think you are.
                              hmm. I have a list in mind. Which "modern" one clears the screen
                              when you send a form-feed to it?
                              It occurs to me that you don't know
                              (googling to get a sense of your background makes that apparent).

                              A quick check shows putty doing this. vt100/etc don't. putty, of course,
                              is not a vt100 emulator (or xterm, etc). xterm and anything that emulates
                              vt100 will simply move the cursor to the next line.

                              There's some useful information on vt100.net which you might read before
                              wasting more bandwidth.

                              bye

                              --
                              Thomas E. Dickey
                              Thomas Dickey develops/maintains widely-used tools and libraries for software development (diffstat, yacc, mawk) and terminals (ncurses, lynx, xterm)

                              ftp://invisible-island.net

                              Comment

                              Working...