#Converting AutoHotkey code to c++

6 messages · Page 1 of 1 (latest)

kindred cliff
#

I'm converting an AutoHotkey script to c++
I'm struggling with this part:

VarSetCapacity(s1, k*4)
VarSetCapacity(s0, k*4)
VarSetCapacity(ss, 2*(w+2)*(h+2))
ini:={ss:&ss, s1:&s1, s0:&s0}

; MyFunc: int foo(char* ss, unsigned int* s1, unsigned int* s0)
return DllCall(&MyFunc, "Ptr",ini.ss, "Ptr",ini.s1, "Ptr",ini.s0)

How i converted it in cpp, my doubt if this is correct or could be improved:

std::string ss(2 * (w + 2) * (h + 2), '\0');
std::vector<unsigned int> s1(k * 4);
std::vector<unsigned int> s0(k * 4);

foo(ss.data(), s1.data(), s0.data());

int foo(char* ss, unsigned int* s1, unsigned int* s0)
{
}
neat lanternBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

jade pulsar
#

which is a bit weird I

#

what is this meant to do anyway

kindred cliff