What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » trouble with strings [C++]

trouble with strings [C++]
Author: Message:
TazDevil
Full Member
***

Avatar
sleep(0);

Posts: 359
Reputation: 11
41 / Male / Flag
Joined: May 2004
RE: trouble with strings [C++]
you must appreciate the scope of the pointer creation and life time...

you create a databloc in Plus! before calling the c++ function... this pointer can exist globaly to the script.

then in your c++ module you replace a string that is only created and available on the scope of hte particular function in c++ so once the function returns the pointer *test is no longer available, as you exit the scope of the function.

instead you should write to the pointer  already supplied by Plus!, the databloc, so it will be readable by Plus! after modifications... or create a new memory allocation with the c++ function that you will need to release later on, to avoid memory leaks, buildups etc...

so you use ...
int function(char* string, int len)
{
// string is the pointer to your databloc you created in plus script
// len points to the maximum space allocated in the databloc, to make sure you dont exceed the limit.
return strncpy(string, "Hello World!", len);
}

this way you write to the same pointer which is valid in plus as well.

quote:
From script manual, databloc object

[string] ReadString(
    [number] Offset,
    [boolean,optional] ReadUnicode,
    [number,optional] Size
);


you can specifically read ASCII you assigning ReadUnicode to FALSE as it is TRUE by default.
Window Manager is discontinued, for WLM try the new,
Enhancer for contact list docking, auto-hide, hide taskbar button, remove button flashing and remember keyboard layout in conversation windows
06-08-2007 07:49 AM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
trouble with strings [C++] - by cooldude_i06 on 06-08-2007 at 03:40 AM
RE: trouble with strings [C++] - by TazDevil on 06-08-2007 at 07:49 AM
RE: trouble with strings [C++] - by cooldude_i06 on 06-09-2007 at 08:54 AM
RE: trouble with strings [C++] - by vikke on 06-09-2007 at 09:07 AM
RE: trouble with strings [C++] - by cooldude_i06 on 06-09-2007 at 08:29 PM
RE: RE: trouble with strings [C++] - by TazDevil on 06-09-2007 at 08:44 PM
RE: trouble with strings [C++] - by cooldude_i06 on 06-09-2007 at 10:29 PM
RE: trouble with strings [C++] - by CookieRevised on 06-10-2007 at 03:06 AM
RE: RE: trouble with strings [C++] - by cooldude_i06 on 06-10-2007 at 07:06 AM
RE: trouble with strings [C++] - by TheBlasphemer on 06-10-2007 at 12:05 PM
RE: trouble with strings [C++] - by cooldude_i06 on 06-10-2007 at 09:09 PM
RE: trouble with strings [C++] - by -dt- on 06-11-2007 at 04:10 AM
RE: trouble with strings [C++] - by cooldude_i06 on 06-11-2007 at 07:34 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On