It appends character c to the end of the string, increasing its length by one.
DeclarationFollowing is the declaration for std::string::push_back.
void push_back (char c);C++11
void push_back (char c);C++14
void push_back (char c);Parameters
c − It is a character object.
Return Valuenone
Exceptionsif an exception is thrown, there are no changes in the string.
ExampleIn below example for std::string::push_back.
#include <iostream> #include <fstream> #include <string> int main () { std::string str; std::ifstream file ("sample.txt",std::ios::in); if (file) { while (!file.eof()) str.push_back(file.get()); } std::cout << str << '\n'; return 0; }
string.htm
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4