std::string is the C++ standard library's byte-based "string" type, defined in the
Questions tagged [stdstring]
1177 questions
-5
votes
1 answer
What it is the meaning of this error: conversion from 'char* [40] to non-scalar type 'std::string
I am new in programming in Cpp and I am doing a program with a class that must contains one name, the sex, the age and the phone number of the person.
I got three errors.
There is my program:
enter code here
#include
#include…

Missmile03
- 21
- 1
- 1
-5
votes
2 answers
Converting std::string from const_iterator to char*?
I have an iterator of type:
std::map::const_iterator
and as you can see the map is storing std::strings.
I am trying to extract a value using:
x.second.c_str()
and pass it to a function to call the regex.h function regexec(),…

user997112
- 29,025
- 43
- 182
- 361
-5
votes
1 answer
How to print std::string array with printf in c++?
I am trying to print std::string with printf and this my code. But it does not print the string I assigned.
Header File
#include "cocos2d.h"
#include
class Cards : public cocos2d::CCLayer{
public:
virtual bool init();
virtual…

Rafi Magsi
- 3
- 1
- 7
-6
votes
1 answer
how to remove a substring of unknown length from a string - C++
I have a string (URL) which I know part of, but not all of it. Some of the string I want to remove, but the string can vary in length, so I can't use the erase() function from .
An example URL I may work…

Batcastle
- 170
- 12
-6
votes
1 answer
C++ using std::string - why?
I wanted to ask,
how does string::string operator function, I know that it is a standard constructor, for using strings, yet what does operator do? Does it allow me to use the multiplier operator at the end? Size_t represents the size of an object…

Dimitri
- 31
- 1
- 10
-6
votes
3 answers
How to replace characters inside a string with "*" in C++?
I am new to C++. My task is to replace the last 3 characters of a string variable with "*". The size of string can be variable.
For Example: - If String xyz = "123456" then it should replace 456 with "***" and the output string should look like…

user1466466
- 1,206
- 5
- 15
- 19
-8
votes
2 answers
Error while using += operator in Qt
I create a small app in Qt Creator. I wanted this code in my QDialog constructor, but it doesn't work.
std::string wyniki = "apg -q -n " + n + " -m " + m + " -x " + sx + " -a " + a;
if(exclude != "") wyniki+=" -E " +…

TN888
- 7,659
- 9
- 48
- 84