We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f761852 commit 791e5b1Copy full SHA for 791e5b1
1 file changed
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
+ fread(&ch, 1, 1, file);
382
+ lastCh = 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