This question already has answers here:
console print w/o scrolling
(7 answers)
Closed 1 year ago.
I have a program that is a simulation, it updates constantly and writes messages in terminal, however, this causes the terminal to constantly scroll with new lines. I am wondering if there is a way to make terminal print lines and then clear after 10 seconds and then update?
Many terminals accept special escape codes allowing the programmer to move the cursor, set the colour and many more functions.
To use it good people wrote the ncurses library https://tldp.org/HOWTO/NCURSES-Programming-HOWTO/
Related
This question already has answers here:
Why would I need use fflush on stdout before writing to stderr?
(2 answers)
What are the rules of automatic stdout buffer flushing in C?
(5 answers)
Closed 2 years ago.
I searched the web for this, but can't find satisfactory result.
Can anyone show me the use of fflush(stdout) in C and a simple code that can be run with and without fflush(stdout) so that it is easy to figure out the difference in the output. Also please explain the same in simplest form.
This question already has answers here:
Non blocking getch()
(2 answers)
Closed 3 years ago.
I am making a typing game in C Language in this game letters come from the top of the window and user has to type that letter to delete it and to stop it from touching the specific boundary line if it touches the boundary line user lose points and ultimately lose the game. Now I am having trouble to print the list of the characters and take input at the same time. If I tried to use the scanf() or getch() function they both stop the printing process is there any way that I could get input from a user without stopping the printing process.
Kbhit Function really Works for that problem.
This question already has an answer here:
Game in linux terminal: Changing images: printing over already printed text
(1 answer)
Closed 8 years ago.
Hey so I want to make a game like Snake or Dwarf Fortress in a console/terminal. I want to print a game field with *'s and other symbols and change them without moving to console upwards. How can I do this?
Use a library like ncurses. It is meant for building console-based UIs.
This question already has answers here:
When have you come upon the halting problem in the field? [closed]
(13 answers)
Closed 9 years ago.
I'm building a compiler for a custom language. Is it possible for the compiler to detect any infinite looping condition without running the program?
If so how can I implement it?
You may be able to detect some infinite loops, but in general you can't detect all possible infinite loops (unless your custom language is specifically designed to eliminate general looping constructs). See http://en.wikipedia.org/wiki/Halting_problem.
This question already has answers here:
Color text in terminal applications in UNIX [duplicate]
(4 answers)
Closed 8 years ago.
I am using a Solaris server in my engineering course. Running code through SecureCRT and the gcc compiler. A task we have is to have the user input a string, and for the program to reverse it. The input string needs to show up in red, and I do not know what code manipulates colors to screen.
See Image for input /output
I tried running the code from the first link below, and it didnt output in any colors. It still shows all of the words in the standard black and white
Look into ncurses. It's a library built to handle this sort of thing, among other formatting.
start_color() in curses might be a good start.