MCPcopy Create free account
hub / github.com/Kitware/VTK / ReadLine

Method ReadLine

IO/MINC/vtkMNIObjectReader.cxx:126–151  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Internal function to read in a line up to 256 characters and then skip to the next line in the file.

Source from the content-addressed store, hash-verified

124// Internal function to read in a line up to 256 characters and then
125// skip to the next line in the file.
126int vtkMNIObjectReader::ReadLine(char* line, unsigned int maxlen)
127{
128 this->LineNumber++;
129 istream& infile = *this->InputStream;
130
131 infile.getline(line, maxlen);
132 this->CharPointer = line;
133
134 if (infile.fail())
135 {
136 if (infile.eof())
137 {
138 return 0;
139 }
140 if (infile.gcount() == 255)
141 {
142 // Read 256 chars; ignoring the rest of the line.
143 infile.clear();
144 infile.ignore(VTK_INT_MAX, '\n');
145 vtkWarningMacro(
146 "Overlength line (limit is 255) in " << this->FileName << ":" << this->LineNumber);
147 }
148 }
149
150 return 1;
151}
152
153//------------------------------------------------------------------------------
154// Skip all whitespace, reading additional lines if necessary

Callers 2

SkipWhitespaceMethod · 0.95
ReadFileMethod · 0.95

Calls 2

eofMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected