A file is really nothing more than an array of characters to a computer. It is not possible to "skip" to a given line, unless you know its start index. What you can do though is read the file and count the lines until you reach the line you want. In particular, you can use getline n times.
That said, you need to use a newer compiler. iostream.h ain't no header I've ever heard of (amongst other problems).
Is your question related to IO?
Read this C++ FAQ LITE article at parashift by Marshall Cline. In particular points 1-6.
It will explain how to correctly deal with IO, how to validate input, and why you shouldn't count on "while(!in.eof())". And it always makes for excellent reading.
I don't understand what the code you posted has to do with your question. They seem unrelated. One thing I'll point out is that your Borland compiler must be over 10 years old. Library headers that end with ".h" are not a part of the C++ standard. Conio.h is very much depreciated as it comes from the days of DOS, and was never a part of any standard. I suggest you get a modern compiler, they aren't hard to find and generally cost nothing.
I know Borland C++ is an old compiler, but as much as i want to use another program, i cannot, because this what my professor is using, we can only choose from Borland and Turbo c++
Well if your professor isn't going to teach using an ANSI C++ compiler, then you probably shouldn't be taking his class at all. I think you should bring up this fact with him as it's pretty serious. Would you stick around if the professor was teaching earth science out of a book that said the world was flat?
Last edited by Chris_F; March 2nd, 2011 at 10:13 PM.