"); subroot = NULL; head = NULL; t...">

Why is part of my code not executed?

I use Visual C ++ to compile my plugin for Cinema 4D.

    GeDebugOut("-->");
    subroot = NULL;
    head = NULL;
    tail = NULL;
    success = PolygonizeHierarchy(source, hh, head, tail, &subroot, malloc);
    if (!success) {
        /* .. */
    }
    String str("not set.");
    if (subroot) {
        GeDebugOut("yes");
        str = "yes!";
        GeDebugOut("Subroot name: " + subroot->GetName());
    }
    else {
        GeDebugOut("no");
        str = "no!";
    }
    GeDebugOut("Is there a subroot?   " + str);
    GeDebugOut("<--");

The expected conclusion is as follows:

-->
yes
Subroot name: Cube
Is there a subroot?  yes
<--

(or the same with "no" instead.) But I get

-->
yes
<--


Why are two prints missing here?


This is an ad GeDebugOut.

void GeDebugOut(const CHAR* s,  ...);
void GeDebugOut(const String& s);

A class Stringis concatenative. He overloads the operator +.

String(void);
String(const String& cs);
String(const UWORD* s);
String(const CHAR* cstr, STRINGENCODING type = STRINGENCODING_XBIT);
String(LONG count, UWORD fillch);
friend const String operator +(const String& Str1, const String& Str2);
const String& operator +=(const String& Str);
+5
source share
3 answers

You need to use GeDebugOuthow you use printf:

GeDebugOut("Some message =  %s ", whatever);

where whateveris the c-string, i.e. her type char*.

Since overloading GeDebugOutalso takes a type String, I think you need to use unicode like:

GeDebugOut(L"Is there a subroot?   " + str);
        // ^ note this!

, unicode , CHAR wchar_t, CHAR. - , String, + .

+5

.

"Is there a subroot" - , .

:

GeDebugOut("Is there a subroot? %s ", str);
+1

, GeDebugOut, :

void GeDebugOut(const CHAR* s,  ...);
void GeDebugOut(const String& s);

:

GeDebugOut("Is there a subroot?   " + str);

"Is there a subroot" - , const char*. , String . .

, , + const char* , , GeDebugOut const char* str.

. , printf. String overlaod :

GeDebugOut(String("Is there a subroot?") + str);
+1

All Articles