For some reason c_str() returns empty string, the parameter const chart**out_function
will hold a method name for file operations like fopen
so basically what I do is converting a string I have to c_str() but I get an empty string below is how I do the calls
In this part I just prepare a dictionary with an operation name, as you can notice I am just sending "fopen" as string
pp::VarDictionary fileOp;
pp::VarArray args;
args.Set(0, "filename.txt");
args.Set(1, "wb");
fileOp.Set("args", args);
fileOp.Set("cmd", "fopen");
This function will parse the dictionary sent above and return the name of the function in out_function
and args
in out_params
int ParseMessage(pp::Var message, const char** out_function,
pp::Var* out_params) {
I use this line of code to convert the string to c_string, but It returns empty text
*out_function = cmd_value.AsString().c_str();
here is the full code, it is based on Google Native Client but at the same time it is standard C/C++ code