bool QIODevice::atEnd() const { if ( isSequentialAccess() || isTranslated() ) { QIODevice* that = (QIODevice*)this; int c = that->getch(); bool result = c < 0; that->ungetch(c); return result; } else { return at() == (int)size(); } }
void KeytabReader::getCc() { if(cc == '\n') { linno += 1; colno = 0; } if(cc < 0) return; cc = buf->getch(); colno += 1; }
bool QIODevice::atEnd() const { if ( isSequentialAccess() || isTranslated() ) { QIODevice* that = (QIODevice*)this; const int oldStatus = ioSt; int c = that->getch(); bool result = c < 0; that->ungetch(c); if (ioSt != oldStatus) that->ioSt = oldStatus; return result; } else { return at() == size(); } }
void test_getch(const QString &fileName) { QIODevice *dev = KFilterDev::deviceForFile(fileName); if(!dev) { kdWarning() << "dev=0" << endl; return; } if(!dev->open(IO_ReadOnly)) { kdWarning() << "open failed " << endl; return; } int ch; while((ch = dev->getch()) != -1) printf("%c", ch); dev->close(); delete dev; }