N
N
Nik_Haker2015-01-23 19:31:07
Programming
Nik_Haker, 2015-01-23 19:31:07

How to clear a string in C++?

How to clear a string so that there is nothing in it at all, as when creating it?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
A
Alexander Taratin, 2015-01-23
@Taraflex

www.cplusplus.com/reference/string/string/clear

J
jackroll, 2015-01-23
@jackroll

Nik_Halker, read https://vk.com/doc268862046_361408455 and watch https://www.youtube.com/user/KennyMcKormic123/videos

K
Kolya Kiselyov, 2015-01-24
@dominqnta

string="";

K
Konstantin, 2015-01-26
@baraboshinkg

If C is a string then:
str[0] = 0;

4
44dev, 2018-05-20
@44dev

- C -

int len = LEN_SIZE;
  char *txt;
  txt = malloc(sizeof(*txt)*len);
   for(int a = 0 ; a < len; a++){
    txt[a] = 0;
   }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question