ID:2359188
 
I tried some things, without success. Apparently curse.h instead conio.h isn't sufficient.

Original lib: http://www.byond.com/developer/Ssj4justdale/stdoutshell
Source:
#include <string>
#include <iostream>
#include <stdio.h>
#include <conio.h>

extern "C" __declspec(dllexport) const char * shell(int argc, char ** argv);

std::string result;

const char * shell(int argc, char ** argv) {
FILE* pipe = _popen(argv[0], "r");
if (!pipe) return "ERROR";
result.clear();
char buffer[128];
while(!feof(pipe)) {
if(fgets(buffer, 128, pipe) != NULL)
result.append(buffer);
}
_pclose(pipe);
return result.c_str();
}
Well, you didn't exactly say what issue you're having. Have you tried popen() instead of _popen()? It's part of stdio.
In response to Nadrew
Converting is the wrong term, what I was wanting is port. I tried it that you said too, but I think that my problem is bigger, a problem that impedes me of test anything in unix server. Check more details: http://www.byond.com/forum/?post=2359294

Login to reply.