I declared a ifstream object to process IGES file in code. IGES file is a kind of text file which has 80 characters per

line. I want to move get pointer to a specific line begining, as IGES file is fixed line length format, seekg function

should be more efficient than ignore function. I know that newline character is translated to and from carriage

return¨Clinefeed pairs in text mode, but I don't know seekg function thinks of newline character as one character or

two characters. I tried following code:

MyFile.seekg(82*nLine,ios::beg); //nLine is number of lines jumped over

and:

MyFile.seekg(81*nLine,ios::beg);

respectively.

It seemed that newline character is thought of as two characters in some files and one character in some other files.

Why?

I also tried the following code:

MyFile.seekg(0,ios::beg);

for(short i=0; i<nLine; i++)

MyFile.ignore(100,'\n');

int num = MyFile.gcount(); //this line only for check

As a result the get pointer jumped to correct position in some files while stopped somewhere before correct position

is reached in some other files, but in both case num always equals 81. Why?

Your help is greatly appreciated.