Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

returning character to beginning of line

Status
Not open for further replies.

ianfo

Programmer
Aug 20, 2002
29
GB

Hi, is there a way to tell the print function to print at the beginning of the line? At the moment, i've cheated by using print "\b\b\b\b\b\b\b\b\b\b\b\b$var"; but it's not very tidy!

Thanks
 
what are you printing BEFORE this ?
did you also print a '\n' ? ------------ jamisar
Einfachheit ist das Resultat der Reife. (Friedrich Schiller)
Simplicity is the fruit of maturity.
 
sorry, should have put some more details

There will be no newline before it as I want to print a string, then go to the beginning of the line and print another string (essentially over the top of the first string)
 
a possible way:

printf("abba");
printf("\n\v");
printf("baab");
------------ jamisar
Einfachheit ist das Resultat der Reife. (Friedrich Schiller)
Simplicity is the fruit of maturity.
 
That didn't help, sorry.

My program goes round in a loop and prints one string after another to the screen. I just need the printed string to appear in the same place the previous one did instead of being on a new line or appearing after the previous string on the same line...
 
the samble above works for /bin/printf
for perl change "\n\v" by
"%c%c",10,11 # decimal vaules for \n and \v ------------ jamisar
Einfachheit ist das Resultat der Reife. (Friedrich Schiller)
Simplicity is the fruit of maturity.
 

Got it working with the following....

print "\r$var";

Thanks for your help anyway :eek:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top