Top "Stdstring" questions

std::string is the C++ standard library's byte-based "string" type, defined in the <string> header.

c++ Function to format time_t as std::string: buffer length?

I want a function that will take a time_t parameter and an arbitrary format string and format it. I …

c++ time buffer stdstring strftime
C++ std::string alternative to strcpy?

I know there is a similarly titled question already on SO but I want to know my options for this …

c++ stdstring strcpy
Can I safely use std::string for binary data in C++11?

There are several posts on the internet that suggest that you should use std::vector<unsigned char> or …

c++ c++11 stdstring
Easily initialise an std::list of std::strings?

In C++0x, what I want would be: std::list<std::string> colours = {"red", "blue", "green", "grey", "pink", "…

c++ initialization stdstring stdlist
C++ copy std::string to char array with no null termination

I am writing to a binary file using a struct that just contains a char[32]. I basically need to format …

c++ stdstring strcpy arrays
C++ : Does char pointer to std::string conversion copy the content?

When I convert a char* to std::string using the constructor: char *ps = "Hello"; std::string str(ps); I know …

c++ string constructor stdstring
How to force std::stringstream operator >> to read an entire string?

How to force std::stringstream operator >> to read an entire string instead of stopping at the first whitespace? …

c++ stl stringstream stdstring
Substring of a std::string in utf-8? C++11

I need to get a substring of the first N characters in a std::string assumed to be utf8. I …

c++ c++11 utf-8 substr stdstring
Using strings in switch statements - where do we stand with C++17?

Every one of us has (probably) had the childhood dream of writing: switch(my_std_string) { case "foo": do_stuff(); …

c++ switch-statement stdstring c++17 string-literals
Read and remove first (or last) line from txt file without copying

I wanna read and remove the first line from a txt file (without copying, it's a huge file). I've read …

c++ fstream getline stdstring boost-interprocess