as we use \n for next line is there anyway to go back to the previous line if not then, is there anyway i can use the x,y coordinates of the runtime window.

all the experts, Please Help......

Thanks.

If you want to be able to scroll backwards in the file then you need to keep track of the beginning of each line. call ftell() to get the current byte location, then after reading the next line just call seek() with the location that was returned by ftell(). If you want to go back to any random line number at any time then you will want to keep an int array of the return value of ftell().

Thank you for this method, but is there anyway i can do that without using file handling as i'm not that good at it and kind of a neubie.....

>>is there anyway i can do that without using file handling
Its not all that difficult.

FILE *fp = fopen("filename","r");
unsigned int curpos = fetll(fp);

// go back to previous line
fseek(fp,curpos,SEEK_SET);

Do u mean reading from a file or standard input that is keyboard
If it is standard input u can try
gotoxy (x,y) function

Do u mean reading from a file or standard input that is keyboard
If it is standard input u can try
gotoxy (x,y) function

Only if his compiler supports that function. That is a TurboC/TurboC++ function only. No other compiler I know of has that function, but then I don't know every compiler in the world either :)

The ncurses API supports random positioning of text on screen.
The Win32 Console API supports the same thing.
State your OS and compiler for a more specific answer.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.