Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (7th_zorro), 1,390 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
is it possible to send an char array to a DLL library? #413561
12/15/12 12:24
12/15/12 12:24
Joined: Jul 2011
Posts: 69
P
pjotr987 Offline OP
Junior Member
pjotr987  Offline OP
Junior Member
P

Joined: Jul 2011
Posts: 69
hi guys,
i have the following question. i want to send files over network, therefore i have a program that works fine as C++ console program. i provide the ip and the path of the file as parameters. now i wanted to make a function for 3DGS. here is the code for the socket initiation:

DLLFUNC void* start_network(int stat, char* ziel[])
{

if(stat==1)
{
runserver();
}
if(stat==2)
{
runclient(ziel[1],ziel[2]);
}
return 0;
}


first problem:
how to pass a char array to the start_network function. so that i can set the ip and path in 3dgs.
second question:
if it is possible how to initialize and call the start_network function in LiteC.
by the way the server part is working properly, the problem seems to be around char* ziel[] array data exchange.

thanks in advance for any sugestions

Re: is it possible to send an char array to a DLL library? [Re: pjotr987] #413689
12/16/12 12:37
12/16/12 12:37
Joined: Jul 2002
Posts: 3,208
Germany
Error014 Offline
Expert
Error014  Offline
Expert

Joined: Jul 2002
Posts: 3,208
Germany
So, here's your disclaimer: I'm an idiot, have absolutely no programming experience with DLLs, consider them black vodoo magic vastly beyond my abilities, and should probably not answer.


But did you know about _chr?

Quote:

_chr(STRING* string);

Converts a STRING to a null-terminated character array; sometimes useful for functions called from external languages.

Parameters:
string - STRING* or char* pointer to be converted.

Returns:
char* - pointer to the char array contained in the STRING*.

Speed:
Fast

Remarks:
This function automatically detects whether its argument is a STRING* or a char*; the char* string must be null-terminated and contain at least 3 characters.

Example:
my_dll_function(_chr(pMyString));


(for completeness' sake, there's also _str, which turns a char*-string to a STRING*-string)


Again, I'm not building on any kind of experience here, so apologies if this doesn't help at all. It did kinda fit the question, though laugh

Last edited by Error014; 12/16/12 12:38. Reason: corrected tags

Perhaps this post will get me points for originality at least.

Check out Dungeon Deities! It's amazing and will make you happy, successful and almost certainly more attractive! It might be true!

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | 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