realbasic-plugins
[Top] [All Lists]

REALstring problem

To: REALbasic Plugins <realbasic-plugins at lists dot realsoftware dot com>
Subject: REALstring problem
From: Alexander Cohen <alex at toomuchspace dot com>
Date: Tue, 20 Jul 2004 09:56:00 -0400
Delivered-to: realbasic-plugins at lists dot realsoftware dot com
List-help: <mailto:realbasic-plugins-request@lists.realsoftware.com?subject=help>
List-id: REALbasic Plugins <realbasic-plugins.lists.realsoftware.com>
List-post: <mailto:realbasic-plugins@lists.realsoftware.com>
HI, im getting some weird results in a plugin. for testing purposes i created a plugin method that takes a string, and prints out each character along with it's ascii value. The first time this method is called, all goes through well, the second time, instead of spaces (char 32) i get NULL values (char 0). The string im passing is UTF-8. here's the routine: (REALDebugMsg is an internal routine that can take a char* and an int and outputs it to the console).

static void
_OutputRbString( REALstring c )
{
        REALLockString( c );
        char    *       s = (char*)c->CString();
        int                     len = c->Length();
        
        char    w[2];
        w[1] = 0;
        
        for (int i = 0; i < len; i++)
        {
                w[0] = s[i];
                REALDebugMsg( w, s[i]);
        }
}

Any ideas whats going on with the string here?

Alex

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>