LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   calling linux program from wine (https://www.linuxquestions.org/questions/linux-software-2/calling-linux-program-from-wine-772450/)

fachamix 11-30-2009 09:01 AM

calling linux program from wine
 
I need to call abiword from a program compiled under windows, but executing it in linux using wine

but not only calling abiword, I need to send a parameter to it, to open random files generated by the program.

so I have the program:

#include <stdio.h>
#include <stdlib.h>

int main()
{
printf("testing");
printf("calling abiword from wine ....");
system("/bin/sh -c /usr/bin/abiword");
return 0;
}



I compiled, and run it under linux:

wine program.exe

and prints the text and opens abiword .... perfect.


Now I want to call abiword with a parameter... this parameter should be a file to open . so my C code of program.exe changes to:

#include <stdio.h>
#include <stdlib.h>

int main()
{
printf("probando ejecutable");
printf("llamando a ABIWORD desde wine ...");
system("/bin/sh -c /usr/bin/abiword file.txt");
return 0;
}

compiled and executed in linux:

wine program.exe

its just opening the abiword ,... but it does not open the file.


so I try to make and script in linux, so my program.exe could call a script qith a parameter.

script.run :

#!/bin/sh
echo "testing..."
/usr/bin/abiword $1
echo "end..."
read
exit


and now my program would be like this:

#include <stdio.h>
#include <stdlib.h>

int main()
{
printf("probando ejecutable");
printf("llamando a ABIWORD desde wine ...");
system("/bin/sh -c /script.run file.txt");
return 0;
}


no case, it just opens abiword without opening the file file.txt

if I try my script pure in linux using ./script.run file.txt .... it opens abiword with the file.txt in it.


I dont know what to do

________________________


if there is any type mistake in codes, is because I am writting it fast in the forum , but the original codes are ok

fachamix 11-30-2009 09:11 AM

SOLLLLVEDDDDDDDDDDDDDDDD

original code of program.exe:
#include <stdio.h>
#include <stdlib.h>

int main()
{
printf("probando ejecutable");
printf("llamando a ABIWORD desde wine ...");
system("/bin/sh -c /script.run file.txt");
return 0;
}

modified code:
#include <stdio.h>
#include <stdlib.h>

int main()
{
printf("probando ejecutable");
printf("llamando a ABIWORD desde wine ...");
system("/bin/sh -c \"/script.run file.txt\"");
return 0;
}


works perfectly


All times are GMT -5. The time now is 06:28 PM.