ignore
is declared as a std::string
. It appears that the original author of the code you are looking at was not aware of the std::istream::ignore
function and is using a local variable to read in elements of the file they are simply discarding (that is, he didn't care about). So the lines like:
fin >> ignore >> vcount;
Are reading in a string element (basically up to the first whitespace) and dumping it into the local string he is ignoring, and then reading in the vcount
value (which he is storing as an unsigned int
).
If you are going to port this to C#, you could do the same thing (read in parts of the file and simply discard them) and it would be a fairly direct port.
As an example (not tested):
using (FileStream file = new FileStream("File.txt", FileMode.Open))
using (StreamReader reader = new StreamReader(file))
{
// with your sample, this will read "VertexCount: 31076"
string line = reader.ReadLine();
string sVCount = line.Substring(line.IndexOf(": ") + 2);
uint vcount = int.Parse(sVCount);
// ... read of your code
}