本文介绍了等价的C到fstream的的偷看的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道在C ++中,你能够通过使用下一个字符偷看: in.peek();
I know in C++, you're able to peek at the next character by using: in.peek();
.
怎么会去这样想窥视当一个文件在C下一个字符?
How would I go about this when trying to "peek" at the next character of a file in C?
推荐答案
+的。也许是这样的:
fgetc+ungetc. Maybe something like this:
int fpeek(FILE *stream)
{
int c;
c = fgetc(stream);
ungetc(c, stream);
return c;
}
这篇关于等价的C到fstream的的偷看的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!