03-28-2011
It's not "depreciated" -- C never had it. I don't think Windows ever had it, either. Certain odd compilers like Borland's may have provided it through a nonstandard library and conio.h, and now you're learning what "portable" means.
Fortunately since you're printing to an actual terminal that understands actual escape sequences, nothing prevents you from [url=https://www.unix.com/302356413-post3.html]making your own[/url]. Just print the right characters and your terminal, if capable, should obey it.
[url=http://ascii-table.com/ansi-escape-sequences.php]here's[/url] a table of ASCII escape sequences to help you build on the functions I linked above. To clear a line, for example:
[code]void clearline(void)
{
/* The \r moves it to the beginning of the line */
printf("\r\033[K");
}[/code] Also note you may need to fflush() after calling these functions to make sure they're printed to the screen right when you want them to be, instead of after the next newline you print. Or just fprintf(stderr, "..."); instead of printf("..."); so it'll never buffer -- though you actually want it to buffer for less flicker. If anything you might want to make the buffer bigger -- you could print a whole screenful of stuff in individual bits, then fflush(stdout); to redraw in one whack.
Oh, you're in Windows. We do have a windows section but this isn't it.
Last edited by Corona688; 03-28-2011 at 12:37 PM..
8 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have directories full of files that contain dates and times in their names in the format YYYYMMDDhhmm. So like, one of the files is named 199407271609 with no file extension.
I have this script searches a given directory and changes all creation dates of the files to match the date in their... (4 Replies)
Discussion started by: hot_pants
4 Replies
2. UNIX for Dummies Questions & Answers
I have an odd problem with my internet connection. I think it's software not hardware, but I'm not even certain of that. My best guess is that it relates to my recent installation of KVpnc.
I can't connect to most websites: no ping, nothing in the browser. But other websites I can connect to... (7 Replies)
Discussion started by: CRGreathouse
7 Replies
3. OS X (Apple)
Hi,
I'm trying to create a virtual screen, (maybe xvfb? or any other virtual screen buffer) and be able to use Screen Sharing to connect to it.
The setup is that I have a Mac Mini connected to the TV. But when my girlfriend is using Front Row, I can't use Screen Sharing at the same time from... (0 Replies)
Discussion started by: linge
0 Replies
4. Red Hat
Hi,
I have a simple question : how to disable screen lock and/or sreen saver with command line with RHEL5.4 ? (1 Reply)
Discussion started by: albator1932
1 Replies
5. AIX
VIO Server connected to switch port and running with half duplex speed on one of the shared ethernet adapter. We have verified at switch end and everythings looks good.
Other ethernet adapter in the VIO server are connected and running in Full duplex speed.
Please help me find why this shared... (4 Replies)
Discussion started by: mugunthanvh
4 Replies
6. UNIX for Dummies Questions & Answers
Hello out there, I got this script that runs partly fine by my crontab. Problem is it gets to the sleep 300(which should be 5 minutes right?) part and never runs the rest of the scripts past that. All individual scripts run just fine. My var/mail file only shows it up to the " echo "Loader Stop... (3 Replies)
Discussion started by: vsekvsek
3 Replies
7. UNIX for Dummies Questions & Answers
I made a screen within a screen.
Is there a way to move the inner screen up one level so that it is at the same level as the first screen running from the shell? (2 Replies)
Discussion started by: phpchick
2 Replies
8. Shell Programming and Scripting
Hello Friends,
I have directory called /tmp. which stores the log files.
Whenever it becomes full, i want to delete half of files from all log files.
even after deleting the files, if space is more than 90% then it should delete rest of half files.
While deleting files, older files... (7 Replies)
Discussion started by: Nakul_sh
7 Replies
LEARN ABOUT OSX
ansi_code
term::ansi::code(n) Terminal control term::ansi::code(n)
_________________________________________________________________
NAME
term::ansi::code - Helper for control sequences
SYNOPSIS
package require Tcl 8.4
package require term::ansi::code ?0.1?
::term::ansi::code::esc str
::term::ansi::code::escb str
::term::ansi::code::define name escape code
::term::ansi::code::const name code
_________________________________________________________________
DESCRIPTION
This package provides commands enabling the definition of control sequences in an easy manner.
::term::ansi::code::esc str
This command returns the argument string, prefixed with the ANSI escape character, "