Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Command line fuckery

Name: Anonymous 2007-10-16 9:23

I want to write several lines to the console, but after each line, I want to clear the screen and then write the next line. From what I gather I can use the "\x08" character (backspace) to achieve this. How do I cleared screen?

Name: Anonymous 2007-10-16 9:39

C-l

Name: Anonymous 2007-10-16 9:51

Echo 1000 blank lines

Name: Anonymous 2007-10-16 9:56

man curses(3)

Name: Anonymous 2007-10-16 10:33

system("clear");

Name: Anonymous 2007-10-16 10:34

Take a cloth and clear the screen before the new line is written. If you can't clear the screen soon enough, use sleep(x).

Name: Anonymous 2007-10-16 11:22

while true ; do clear ; echo "desu"; clear ; echo " desu" ; clear ; echo "  desu" ; done

Name: Anonymous 2007-10-16 11:37

Name: Anonymous 2007-10-16 15:52

\r on the correct OS does the job

Name: Anonymous 2007-10-16 16:13

>>9
\r is just a carriage return, I'm pretty sure it doesn't do that on *any* operating system. For reference, it doesn't work as you described on either Windows or BSD. I can't speak for any other backwards operating systems.

>>8
Happen to have an example of how to use this? I can't get it to work -

#include <cstdio>

int main( int argc, char* argv[] ) {
    char p[] = { 0x9b, '2', 'J', 0 };
    printf( "%s%s", "DESUDESUDESU", p );
    return 0;
}


Output: DESUDESUDESU›2J

Name: Anonymous 2007-10-16 16:14

>>10
Actually, you know. It might just be that I'm using a ssh client which can't handle the escape codes properly. I should consider getting something that isn't a piece of shit.

Name: Anonymous 2007-10-16 16:19

>>10
Try 27,'[' instead of 0x9b.

Name: Anonymous 2007-10-16 16:23

>>9
An OS with a one line TTY?

Name: Anonymous 2007-10-16 16:29

>>12
Sweet, that worked. Thanks :)

Name: Anonymous 2007-10-16 16:32

>>13

That uses paper?

Name: Anonymous 2007-10-16 17:12

OP here, I worked it out myself.

This thread is truly a testament to the hive of consciousness  that it /prog/. Unintentional reverse psychology: Trolls + misdirection = OP motivation.

Name: Anonymous 2007-10-16 18:25

This thread is full of newfags. Obviously no one knew about libclear

http://dis.4chan.org/read/prog/1184222474

Name: Anonymous 2007-10-16 19:46

>>17

This thread is full of newfags.
 his thread is full of newfags.
  is thread is full of newfags.
   s thread is full of newfags.
     thread is full of newfags.
      hread is full of newfags.
       read is full of newfags.
        ead is full of newfags.
         ad is full of newfags.
          d is full of newfags.
            is full of newfags.
             s full of newfags.
               full of newfags.
                ull of newfags.
                 ll of newfags.
                  l of newfags.
                    of newfags.
                     f newfags.
                       newfags.

Fuck off back to /b/

Name: Anonymous 2007-10-16 20:12

>>18
I should to write a noodle to do this, lawds.

Name: Anonymous 2007-10-17 3:28

>>10
For any other backwards operating systems, other than BSD and Windows?

This post is free text: you can copypasta it and/or modify it under the terms of the GNU Trolling Public License as published by the Free Software Foundation.

This post is made in the hope that it will be fun, but WITHOUT ANY WARRANTY; without even the implied warranty of SUCCESS or ON TOPIC FOR A PARTICULAR THREAD. See the GNU Troll Public License for more details.

You should have received a copy of the GNU Trolling Public License along with this post. If not, see <http://www.gnu.org/yhbt/>;.

Name: Anonymous 2007-10-17 4:10

>>18
OK NOW YOU FUQIN ANGERED AN EXPERT PROGRAMMER

Name: Anonymous 2007-10-17 4:39

>>18 wrote a script to do that fancy string decomposition for him

Name: Anonymous 2007-10-17 6:21


(defun f (l) (if l (f (cdr (print l)))))

Name: Anonymous 2007-10-17 13:47

>>23
I'm no EXPERT PROGRAMMER, but that isn't the same as >>18. Also, lol Common Lisp.

Name: Anonymous 2007-10-17 14:10

If you want to write just one line and then have the next line replace that one, you could use non buffered output functions like write instead of printf and such.

Because basically that's what you're saying, write one line then clear the screen and write the next one. That would be exactly the same as overwriting the last line, just figure out how long you have to write by getting information about the terminal size.

Name: Anonymous 2007-10-17 14:40

>>24

for(p = "This thread is full of newfags."; strcmp(p, "newfags."); printf("%s\n", p++);

Name: Anonymous 2007-10-17 14:41

>>26
sigh.. i forgot a parenthesis.

Name: Anonymous 2007-10-17 15:08

>>27
That's what you get for using a cudder based... wait, you weren't? No wonder Ctards are scared of Lisp! They can't handle a single level of nesting.

Name: Anonymous 2007-10-17 15:34

>>27
Since you forgot a parenthesis, you will spend the rest of your life falling or being crushed by strong gravity. Your choice.

Name: Anonymous 2007-10-17 15:39

>>29
I live in soviet russia. i choose falling.

Name: Anonymous 2007-10-17 15:48

>>26
your for loop doesnt even run, strcmp is fail

Name: Anonymous 2010-12-10 6:37

Name: Anonymous 2011-01-31 21:28

<-- check em dubz

Name: Anonymous 2011-02-03 3:07

Name: Anonymous 2011-02-04 18:34

Name: Anonymous 2013-01-19 23:22

/prog/ will be spammed continuously until further notice. we apologize for any inconvenience this may cause.

Don't change these.
Name: Email:
Entire Thread Thread List