Javatpoint Logo
Javatpoint Logo

tellp() function in C++

Introduction:

The tellp() function returns the pointer's current "put" position in the stream when used with output streams. It has no parameters and returns a value of the member type pos_type, an integer data type that represents the put stream pointer's current position.

Syntax:

Return -

If successful, the current output position indication; otherwise, return -1.

Example:1

Output:

the current position of pointer is :10

Explanation:

In the code above, the tellp() function returns the current position in the file to which it points.

Example 2 -

Output:

this is a sample

Explanation:

In this case, the tellp() method returns the position of the pointer. After that, the pointer is shifted back from the current place by 7 positions using the seekp() function, and the content is then inserted there.







Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA