Gamestudio Links
Zorro Links
Newest Posts
How to select between IB accounts by script?
by AndrewAMD. 06/13/26 15:44
Zorro tutorial ideas?
by AndrewAMD. 06/13/26 15:01
Zorro 3.01 recoded MMI function issue
by 11honza11. 06/13/26 11:40
Max Number of Strategies in /Strategy folder
by Martin_HH. 06/12/26 08:50
Stooq now requires an API key
by AndrewAMD. 06/11/26 17:55
Z9 getting Error 058
by k_ivan. 06/10/26 14:38
ZorroGPT
by TipmyPip. 06/10/26 13:07
Z12 live performance
by alx. 06/09/26 20:42
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
3 registered members (Grant, Quad, VHX), 1,886 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Student_64151, Koti, curry, DeepxKalsi, Samed
19219 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
C++ How Return STRING* ? #340335
09/03/10 09:59
09/03/10 09:59
Joined: Nov 2009
Posts: 37
X
XuserTM Offline OP
Newbie
XuserTM  Offline OP
Newbie
X

Joined: Nov 2009
Posts: 37
Hi,

This is my dll function ,

DLLFUNC string toHex(int number)
{
std::string s;
std::stringstream out;
stringstream stream;
out << number;
s = out.str();
stream << hex << s;
return stream.str();
}

This script good work laugh no proplem bud

I want returun string

DLLFUNC STRING* toHex(int number , STRING* str)
{
std::string s;
std::stringstream out;
stringstream stream;
out << number;
s = out.str();
stream << hex << s;
return stream.str();
}
this script dont work,

and this is lite-c code

function main()
{
wait(2);
STRING* abcd = "#50";
toHex(256 , abcd);

error(abcd);
}
I want 256 convert to hex and save on abcd

Pls help me laugh

Re: C++ How Return STRING* ? [Re: XuserTM] #340344
09/03/10 11:23
09/03/10 11:23
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
hey!
try to return a string and no char*
Code:
DLLFUNC STRING* toHex(int number)
{
    std::string s;
    std::stringstream out;
    stringstream stream;
    out << number;
    s = out.str();
    stream << hex << s;
    return str_create(stream.str());
}



your lite-c part:
Code:
STRING* toHex(int);  //Prototype

function main()
{
wait(2);
STRING* abcd = toHex(256); //Here you call....
error(abcd);
}




Visit my site: www.masterq32.de
Re: C++ How Return STRING* ? [Re: MasterQ32] #340350
09/03/10 11:55
09/03/10 11:55
Joined: Nov 2009
Posts: 37
X
XuserTM Offline OP
Newbie
XuserTM  Offline OP
Newbie
X

Joined: Nov 2009
Posts: 37
verryy veryyy thanks its work :)) thanks
DLLFUNC STRING* toHex(int number)
{
std::string s;
std::stringstream out;
stringstream stream;
stream << hex << number;
s = stream.str();
//char
char *a=new char[s.size()+1];
a[s.size()]=0;
memcpy(a,s.c_str(),s.size());
//char
return str_create(a);
}


This is my frist dll for 3dgs laugh
hex converter grin

Re: C++ How Return STRING* ? [Re: XuserTM] #340357
09/03/10 13:11
09/03/10 13:11
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
why not?
i created an unuseable level loader wink
you can design the level with xml, but who needs somesthing like this

but i'm thinking about a panel designer, which creates Panels and Huds from a xml file
what do you think about this?


Visit my site: www.masterq32.de
Re: C++ How Return STRING* ? [Re: MasterQ32] #340360
09/03/10 13:14
09/03/10 13:14
Joined: Nov 2009
Posts: 37
X
XuserTM Offline OP
Newbie
XuserTM  Offline OP
Newbie
X

Joined: Nov 2009
Posts: 37
???
Very good laugh Do it grin

Last edited by XuserTM; 09/03/10 13:16.
Re: C++ How Return STRING* ? [Re: XuserTM] #340361
09/03/10 13:22
09/03/10 13:22
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
thanks, but first i will finish (i hope) my otehr project!
watch out for some posts of me, it will be a cool new feature wink
and don't ask what!


Visit my site: www.masterq32.de
Re: C++ How Return STRING* ? [Re: MasterQ32] #340532
09/05/10 10:17
09/05/10 10:17
Joined: Jul 2008
Posts: 894
T
TechMuc Offline
User
TechMuc  Offline
User
T

Joined: Jul 2008
Posts: 894
just a small hint:

sprintf (char_val,"%X",123);

is C-Lite code and can also convert a number to a hex-character-string.


Moderated by  TWO 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1