LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-30-2009, 10:01 AM   #1
fachamix
Member
 
Registered: Oct 2009
Posts: 122

Rep: Reputation: 16
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
 
Old 11-30-2009, 10:11 AM   #2
fachamix
Member
 
Registered: Oct 2009
Posts: 122

Original Poster
Rep: Reputation: 16
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling Matlab from wine cmd.exe jykgu Linux - Software 1 03-12-2009 10:39 AM
When calling any program, focus does not go to that program kennybob Linux - Desktop 1 08-21-2008 12:30 PM
newbie/program for calling BBS's Ltkpr49 Linux - Software 1 06-29-2005 10:45 AM
Problem calling linux program from Java spasco Programming 3 04-25-2004 01:13 AM
C program code calling a Linux system command Linh Programming 1 06-05-2003 02:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration