Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

system call to gnuplot from C++

329 views
Skip to first unread message

Peter Maigaard

unread,
May 12, 1998, 3:00:00 AM5/12/98
to

Hi,
Previously i used the system call command from C++ to DOS like this :
system("gnuplot \"file\"); This works fine.
I am now working on an MFC based Win32 application in Visual C++5 and want
to use Gnuplot. Why doesn't the statement above work here ?? I get no
errors, but it seems like Gnuplot ignores the file that it is supposed to
load. I tried both an old DOS version of Gnuplot and Wgnuplot (beta 340).
If I open Gnuplot manually from Windows and type the commands from "file"
everything works fine.

With regards
Peter Maigaard.

Peter Maigaard

unread,
May 13, 1998, 3:00:00 AM5/13/98
to

Hi again,
I worked it out myself, I think. Apparently it is necessary to remove the
quotation marks around the "file" from the system call when calling wgnuplot
from a Win32 application :

WinExec("wgnuplot file"); //This works fine
System("wgnuplot file"); //This works fine

WinExec("wgnuplot \"file\"); //This does NOT work
System("wgnuplot \"file\"); //This does NOT work

With the quatation marks in place, wgnuplot is executed but immediatly
closed again since no command from "file" is loaded.
Is this a bug in wgnuplot (beta 340) or is there another (Windows)
explanation ?

Regards
Peter Maigaard.


Lars Hecking

unread,
May 14, 1998, 3:00:00 AM5/14/98
to

"Peter Maigaard" <maig...@egmont-kol.dk> writes:

> Hi again,
> I worked it out myself, I think. Apparently it is necessary to remove the
> quotation marks around the "file" from the system call when calling wgnuplot
> from a Win32 application :
>
> WinExec("wgnuplot file"); //This works fine
> System("wgnuplot file"); //This works fine
>
> WinExec("wgnuplot \"file\"); //This does NOT work
> System("wgnuplot \"file\"); //This does NOT work

This shouldn't even compile, because the quotes are not balanced.

Peter Maigaard

unread,
May 14, 1998, 3:00:00 AM5/14/98
to

Lars Hecking wrote in message ...

>>
>> WinExec("wgnuplot file"); //This works fine
>> System("wgnuplot file"); //This works fine
>>
>> WinExec("wgnuplot \"file\"); //This does NOT work
>> System("wgnuplot \"file\"); //This does NOT work
>
> This shouldn't even compile, because the quotes are not balanced.


Sorry, in my hurry I left out some vital parts of the WinExec calls. This is
what I meant :

WinExec("wgnuplot file",SW_SHOWNORMAL); //This works fine

WinExec(" wgnuplot \"file\" ",SW_SHOWNORMAL); //This does NOT work

Peter Maigaard

0 new messages