libigl v2.5.0
Loading...
Searching...
No Matches
C_STR.h File Reference
#include <sstream>
#include <string>

Go to the source code of this file.

Macros

#define C_STR(X)   static_cast<std::ostringstream&>(std::ostringstream().flush() << X).str().c_str()
 Convert a stream of things to a const char *.
 

Macro Definition Documentation

◆ C_STR

#define C_STR (   X)    static_cast<std::ostringstream&>(std::ostringstream().flush() << X).str().c_str()

Convert a stream of things to a const char *.

Suppose you have a function:

void func(const char * c);

Then you can write:

func(C_STR("foo"<<1<<"bar"));
#define C_STR(X)
Convert a stream of things to a const char *.
Definition C_STR.h:28

which is equivalent to:

func("foo1bar");