Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
std::strstream::pcount(3)     C++ Standard Libary    std::strstream::pcount(3)

NAME
       std::strstream::pcount -	std::strstream::pcount

Synopsis
	  int pcount() const;

	  Returns the number of	characters that	were output in the put area of
       the associated
	  std::strstreambuf. Effectively calls rdbuf()->pcount()

Parameters
	  (none)

Return value
	  The  number  of  characters  in the put area,	or zero	if nothing was
       output.

Example
       // Run this code

	#include <strstream>
	#include <iostream>

	int main()
	{
	    std::strstream dyn;	// dynamically-allocated output	buffer
	    dyn	<< "Test: " << 1.23 << std::ends;
	    std::cout << "The size of the output is " << dyn.pcount()
		      << " and it holds	\"" << dyn.str() << "\"\n";
	    dyn.freeze(false);

	    char buf[10];
	    std::strstream user(buf, 10); // user-provided output buffer
	    user << 1.23; // note: no std::ends
	    std::cout.write(buf, user.pcount());
	    std::cout << '\n';
	}

Output:
	The size of the	output is 11 and it holds "Test: 1.23"
	1.23

See also
		 returns the next pointer minus	the beginning pointer  in  the
       output sequence:
	  pcount the number of characters written
		 (public member	function of std::strstreambuf)

http://cppreference.com		  2022.07.31	     std::strstream::pcount(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=std::strstream::pcount&sektion=3&manpath=FreeBSD+Ports+15.0>

home | help