Usage of SEEKG () and SEEKP () in C + + FStream

Source: Internet
Author: User

Transferred from: http://blog.sina.com.cn/s/blog_679f85d40100mysi.html

Let's talk about the function of fseek () in C language:

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 Prototypes:
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
POS: New file stream pointer position value
OFF: Values that need to be offset
Dir: Where to start the search
The dir parameter is used to locate the file stream pointer, representing the starting position of the search
enumerated types defined in iOS:
Enum Seek_dir {Beg, cur, end};
Meaning of each enumeration constant:
Ios::beg: Where to start the file stream
Ios::cur: Current location of the file stream
Ios::end: End location of the file stream

Usage of SEEKG () and SEEKP () in C + + FStream

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.