We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f761852 commit 1781870Copy full SHA for 1781870
simplecpp.cpp
@@ -377,7 +377,9 @@ class FileStream : public simplecpp::TokenList::Stream {
377
}
378
379
virtual int get() {
380
- lastCh = fgetc(file);
+ unsigned char ch;
381
+ const int res = fread(&ch, 1, 1, file);
382
+ lastCh = (res != 1 && feof(file)) ? EOF : ch;
383
return lastCh;
384
385
virtual int peek() {
@@ -386,7 +388,7 @@ class FileStream : public simplecpp::TokenList::Stream {
386
388
return ch;
387
389
390
virtual void unget() {
- ungetc(lastCh, file);
391
+ fseek(file, -1, SEEK_CUR);
392
393
virtual bool good() {
394
return lastCh != EOF;
0 commit comments