You can use VT100 escape codes. Most terminals, including xterm, are VT100 aware. For erasing a line, this is ^[[2K
. In C this gives:
printf("\33[2K\r");
More Related Contents:
- How can I get the keyboard state in Linux?
- what the output of this code and why?
- printf anomaly after “fork()”
- How to make child process die after parent exits?
- What is time_t ultimately a typedef to?
- What is the equivalent to Posix popen() in the Win32 API?
- How do I execute an external program within C code in Linux with arguments?
- Measure time in Linux – time vs clock vs getrusage vs clock_gettime vs gettimeofday vs timespec_get?
- Sending file descriptor by Linux socket
- Signal handling with multiple threads in Linux
- Best way to invoke gdb from inside program to print its stacktrace?
- How to include needed C library using gcc?
- Unexpected exec permission from mmap when assembly files included in the project
- Whole one core dedicated to single process
- Error: Address already in use while binding socket with address but the port number is shown free by `netstat`
- Finding out what the GCC include path is [duplicate]
- Why do I have to define LD_LIBRARY_PATH with an export every time I run my application?
- Is there a macro definition to check the Linux kernel version?
- Writing to a closed, local TCP socket not failing
- flock vs lockf on Linux
- Read input.txt file and also output.bmp file from terminal (C-programming)
- Write to .txt file?
- Do forked child processes use the same semaphore?
- Implementation of multiple pipes in C
- Force free() to return malloc memory back to OS
- What’s a good C decompiler? [closed]
- In C, what’s the size of stdout buffer?
- What API do I call to get the system uptime?
- Where are syscalls located in glibc source
- Linux function to get mount points