Print spinning cursor in a terminal running application using C

后端 未结 5 988
Happy的楠姐
Happy的楠姐 2021-02-01 07:15

How would I print a spinning curser in a utility that runs in a terminal using standard C?

I\'m looking for something that prints: \\ | / - over and over in the same pos

5条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-01 08:15

    There is no truly "standard" way to do this, since the C Standard Library (http://members.aol.com/wantondeb/) does not provide functions to do raw terminal/console output.

    In DOS/Windows console, the standard-ish way to do it is with conio.h, while under Unix/Linux the accepted library for this purpose is ncurses (ncurses basically encapsulates the control-character behavior that MBCook describes, in a terminal-independent way).

提交回复
热议问题