MCPcopy Create free account
hub / github.com/DentonW/DevIL / iFgets

Function iFgets

DevIL/src-IL/src/il_internal.cpp:182–197  ·  view source on GitHub ↗

Last time I tried, MSVC++'s fgets() was really really screwy

Source from the content-addressed store, hash-verified

180
181// Last time I tried, MSVC++'s fgets() was really really screwy
182ILbyte *iFgets(char *buffer, ILuint maxlen)
183{
184 ILuint counter = 0;
185 ILint temp = '\0';
186
187 while ((temp = igetc()) && temp != '\n' && temp != IL_EOF && counter < maxlen) {
188 buffer[counter] = temp;
189 counter++;
190 }
191 buffer[counter] = '\0';
192
193 if (temp == IL_EOF && counter == 0) // Only return NULL if no data was "got".
194 return NULL;
195
196 return (ILbyte*)buffer;
197}
198
199
200// A fast integer squareroot, completely accurate for x < 289.

Callers 1

ilReadAsciiPpmFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected