问题描述
在循环的每次迭代中,我需要将double值转换为
char *。简单的类型转换不起作用,所以我想使用
stringstreams。但是,在每次b / b
迭代之后,流必须被*清空*(我无法想到这样做的实用方法)。
干杯,
Matthias
-
$ b $bFür电子邮件Anweisung in der Adresse befolgen
During every iteration in a loop, I need to convert a double value into a
char*. Simple type-casting did not work, so I thought of using
stringstreams. However, the stream would have to be *emptied* after each
iteration (and I could not conceive of a practical way doing that).
Cheers,
Matthias
--
Für emails Anweisung in der Adresse befolgen
推荐答案
执行以下操作:
thestream.str("");
Do the following:
thestream.str("");
-
Karthik
------
人类请为我的电子邮件删除。
--
Karthik
------
Human Beings please ''removeme'' for my email.
听起来好像你想要一个双字符串的字符串表示。 char *不是字符串。它是指向char的指针,仅此而已,仅此而已。
Sounds as if you want a string representation of your double. A char* is
not a string. It''s a pointer to char, nothing less, nothing more.
执行以下操作:
thestream.str("");
Do the following:
thestream.str("");
另外:
thestream.str()。clear();
Alternatively:
thestream.str( ).clear( );
这篇关于双 - > C-String转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!