C + + file pointer offset

Source: Internet
Author: User
Tags function prototype

Function prototypes:int fseek (FILE *fp, LONG offset, int origin)

Parameter meaning: FP file pointer offset relative to Origin specified offset position the starting position of the origin pointer movement, can be set to the following three cases: Seek_set file start position seek_cur file Current location seek_end file end Location


Seep () and SEEKG () functions in C + +

SEEKP: Setting the file stream pointer location for the output file stream
SEEKG: Setting the file stream pointer location for the input file stream


Function prototype:
ostream& SEEKP ( Streampos POS);
ostream& SEEKP (streamoff off, Ios::seek_dir dir);
istream& seekg (Streampos POS);
istream& seekg (streamoff off, Ios::seek_dir dir);
Function Parameters
off: Value to offset
dir parameter is used to locate the file stream pointer, representing the starting position of the search
enumeration type defined in iOS:
enum seek_dir {Beg, cur, end};
Meaning of each enumeration constant:
ios::beg: Starting position of the file stream
iOS :: Cur: Current location of the file stream
Ios::end: End position of the file stream


C + + file pointer offset

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.