Search code examples
cprintftextcolor

how to go back to some position already printed in C?


let us have a situation in which the following program prints some 10 lines of #

for(i=0;i<10;i++)
prinf("\n#");

now how to go back to 5 th line and edit that # and change the color of it without clearing the screen or clearing the below 5 lines?

I have tried

window(5,0,20,20);
textcolor(GREEN);
cprintf("#");

but it is not editing that one but it is printing on the side of the original one.why?

is there any other way of doing it and changing the color of the already printed text dynamically? please help me..my environment is turbo c on windows


Solution

  • window function will generally create a window from the 1st two coordinates pixel i.e, in your example (5,0) to the pixel pointed by next 2 coordinates. so your program should work

    try it out or else use gotoxy()