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: [email protected] 
[mailto:[email protected]] On Behalf Of 
john tass
Sent: Friday, May 01, 2015 9:45 PM
To: [email protected]
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.
_______________________________________________
Help-glpk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-glpk

Reply via email to