Hi and I am making a dll but the dll won't accept pointers due to what it links to. So below is my code and does anybody know how to make a string array without pointers? Also I'm using Visual c++ 2008.
//#pragma warning(disable:4996) //disable "depreciated function" warnings
#include <windows.h> //required for dll
#include <sstream>
#define DLLEXPORT extern "C" __declspec ( dllexport )
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
DLLEXPORT std::string *explode (std::string exploder, std::string original, int limit=0) {
std::string tmp;
tmp=original;
int num, loc, x, limiter;
limiter=0;
num=1;
while (tmp.find(exploder)!=std::string::npos) {
if (limiter==limit && limit!=0) { break; }
if (limit>0) { limiter++; }
loc=tmp.find(exploder);
tmp=tmp.substr(loc+exploder.length());
num++;
}
std::string *result;
x=(num+1);
result = new std::string[x];
/*std::string s;
std::stringstream out;
out << x;
s = out.str();
result[0]=s;*/
result[0]="1";
num=1;
tmp=original;
while (tmp.find(exploder)!=std::string::npos) {
if (limiter==limit && limit!=0) { break; }
if (limit>0) { limiter++; }
loc=tmp.find(exploder);
result[num]=tmp.substr(0,loc);
tmp=tmp.substr(loc+exploder.length());
num++;
}
result[num]=tmp;
return result;
}
Thanks...