language agnostic - Is there any (opposite of newline) char? -


was wondering if print right left, bottom top... got thought when trying write program print following square (for input 'n', here n=4 )

1  2  3  4 12 13 14 5 11 16 15 6  10 9  8  7 

this solved many ways, storing 2d array , printing array... (any language: perl, c, c++, java).

the long answer can whatever terminal supports. there many kinds of terminals (or “character output devices”), many of them support cursor motions. (you can see termcap library project create picture different terminal types do.) there terminal command moving line, esentially yes, should able that. after poking in termcap database, came following:

$ printf "\n"; printf '\e[a'; echo foo foo 

in other words, \e[a string has non-zero chance 1 line up. on terminals :)


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -