Also,

I use “Gusek” as my IDE for GLPK/GMPL.  When I ran the below code, but changing 
"c:\temp\MyTextFile.txt" to just "c:\temp\MyTextFile.txt", it placed the file 
in the same directory as it placed the .mod file.  I know that you said you 
looked in that the directory that you have the .mod file, but was that the same 
directory that you started glpsol?

That is, if you were in directory “c:\tttt” and called glpsol by using the 
command line:

C:\glpk\glpsol.exe –m c:\glpk\MyModFile.mod

The MyTextFile.txt file would probably be placed in “c:\tttt” and not “c:\glpk”

-Marc

From: help-glpk-bounces+marc.meketon=oliverwyman....@gnu.org 
[mailto:help-glpk-bounces+marc.meketon=oliverwyman....@gnu.org] On Behalf Of 
Meketon, Marc
Sent: Saturday, May 02, 2015 8:44 AM
To: john tass; help-glpk@gnu.org
Subject: Re: [Help-glpk] Problem with writing to a text file from within 
Mathprog

I tried the following:

#test of writing out to a text file
solve;
printf : 'Hello World!\n' > "c:\temp\MyTextFile.txt";
printf : 'I am fine\n' >> "c:\temp\MyTextFile.txt";
end;

and it worked fine.  At first I thought that the colon (“:”) was the issue, 
since I never use it, but with or without the colon the code worked fine.

My guess:  you did not specify the full path of the output text file, and you 
are looking in the wrong place for it.  But that’s just a guess.

-Marc

From: 
help-glpk-bounces+marc.meketon=oliverwyman....@gnu.org<mailto:help-glpk-bounces+marc.meketon=oliverwyman....@gnu.org>
 [mailto:help-glpk-bounces+marc.meketon=oliverwyman....@gnu.org] On Behalf Of 
john tass
Sent: Friday, May 01, 2015 9:45 PM
To: help-glpk@gnu.org<mailto:help-glpk@gnu.org>
Subject: [Help-glpk] Problem with writing to a text file from within Mathprog

Hi everybody,
I try to create a text file and write two lines in it from within Mathprog 
language.
First, I use Mathprog with a .mod file, which contains my model. At the end, 
after the code that determines my model, I have the following code:
....
.....
solve;
printf : 'Hello world!\n' > "MyTextFile.txt";
printf : 'I am fine\n' >> "MyTextFile.txt";

end;
Please note that I use a separate .dat file for the model's data. In addition, 
glpk manages to solve my model.I use the command line in order to call glpsol.
Nevertheless, no text file named "MyTextFile.txt" appears within the folder 
that glpsol.exe allong with .mod and .dat files are located. In the contrary, 
the file foo.sol, which is defined at the command line next to the option 
--output does appear within the mentioned folder.
Can any one help me?
Thanks a lot in advance
Tassopoulos Ioannis
P.S.
I use Windows 7 64bit OS.


--
Ioannis X. Tassopoulos

________________________________
This e-mail and any attachments may be confidential or legally privileged. If 
you received this message in error or are not the intended recipient, you 
should destroy the e-mail message and any attachments or copies, and you are 
prohibited from retaining, distributing, disclosing or using any information 
contained herein. Please inform us of the erroneous delivery by return e-mail. 
Thank you for your cooperation.

________________________________
This e-mail and any attachments may be confidential or legally privileged. If 
you received this message in error or are not the intended recipient, you 
should destroy the e-mail message and any attachments or copies, and you are 
prohibited from retaining, distributing, disclosing or using any information 
contained herein. Please inform us of the erroneous delivery by return e-mail. 
Thank you for your cooperation.
_______________________________________________
Help-glpk mailing list
Help-glpk@gnu.org
https://lists.gnu.org/mailman/listinfo/help-glpk

Reply via email to