1 Reply Latest reply on Oct 4, 2012 3:42 PM by rela33

    Native application creating files

    rela33

      Hi everybody,

       

      I need a hero

       

      I'm working on a Air app calling a native application in C++, so it is not a .app or .cmd it's an executable file. For now it's a "dummy" application like below:

       

      #include <iostream>

      #include <string>

      #include <fstream>

      using namespace std;

       

      int main(int argc, char ** argv)

      {

                ofstream myfile;

          myfile.open ("test.txt");

          cout << "Hello "<<  argv[1]<< " its a new world!"<<endl;

          myfile << "Writing this to a file.\n";

          myfile.close();

          return 0;

      }

       

      I launch this native application thanks to the NativeProcess API :

       

                  file = file.resolvePath("./application/Marlin/mac/hello");

                  var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();

                  nativeProcessStartupInfo.executable = file;

                  var processArgs:Vector.<String> = new Vector.<String>();

                  processArgs.push("rela");

                  nativeProcessStartupInfo.arguments = processArgs;

       

                  process = new NativeProcess();

                  process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA,onOutputData);

                  process.addEventListener(ProgressEvent.STANDARD_ERROR_DATA,errorDataHandler);

       

                  process.start(nativeProcessStartupInfo);

       

      I can see intthe standart output that my native application is running. I have in the trace : hello rela its a new world!

       

      First question, the native application doesn't pop up, I mean that the console doesn't show up and execute the C++ code. Is it normal or is there a configuration to change that?

       

      Seconde question, my native application creates a file but when I launch with the Air app, the file is not created. Is it possible to launch a native application creating a file? Is there any security or confifuration to set up?

       

      Thanks a lot.