f.seekg(0, ios::beg)

Posted on 2004-10-28
Medium Priority
Last Modified: 2008-01-09
What is the role of  f.seekg(0, ios::beg);
Even if i remove from my read function it does not hurt.
Question by:komlaaa
1 Comment

Accepted Solution

van_dy earned 100 total points
ID: 12439991
f.seekg sets the read/write position in a file.

f.seekg(0, ios::beg)  will set the read position to 0 bytes from the begining
of the file f, exactly at the start. however when you open a file in a non-append
mode (like for reading or writing), the  read position is always at the start. so you
can remove this line without affecting the behaviour of the function in your case.

Featured Post

Free tool for managing users' photos in Office 365

Easily upload multiple users’ photos to Office 365. Manage them with an intuitive GUI and use handy built-in cropping and resizing options. Link photos with users based on Azure AD attributes. Free tool!

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
There's never been a better time to become a computer scientist. Employment growth in the field is expected to reach 22% overall by 2020, and if you want to get in on the action, it’s a good idea to think about at least minoring in computer science …
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

619 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question