ifstream等效于FILE *的rewind方法 [英] ifstream equivalent of FILE *'s rewind method

查看:182
本文介绍了ifstream等效于FILE *的rewind方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的任务是将一些C代码更新为C ++,很好奇,在ifstream中,C FILE *的rewind方法的等效方法或实现是什么?

I've been tasked to update some C code to C++ and was curious, what is the equivalent method or implementation of C FILE *'s rewind method within ifstream?

推荐答案

这将是 seekg (设置获取指针)或 seekp (设置put指针)。在这两种情况下,传递0作为参数,将指针设置为文件的开头。

That would be either seekg (sets the get-pointer) or seekp (sets the put pointer). In both cases, passing 0 as parameter results in the pointer being set to the beginning of the file.

这篇关于ifstream等效于FILE *的rewind方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆