problem with printf

45 views
Skip to first unread message

AliReza Madadi

unread,
May 29, 2010, 1:33:48 AM5/29/10
to AMPL Modeling Language
Hi everyone,

I have a problem with printing output of a binary variable to a txt
file. I want to display the results in the txt file as (two columes):
L0 0
L1 1
L2 0
L3 1

I tried this command "printf {l in L} "%-5s %d\n", l, x[l] >
output.txt;", but it gives me following error:

Error executing "printf" command:
can't open "output.txt"

I would be appreciative for your help.

Omid


Paul

unread,
May 29, 2010, 10:15:09 AM5/29/10
to AMPL Modeling Language
On May 29, 1:33 am, AliReza Madadi <madadi.alir...@gmail.com> wrote:
>
> I tried this command "printf {l in L} "%-5s    %d\n", l, x[l] >
> output.txt;", but it gives me following error:
>
>   Error executing "printf" command:
>         can't open "output.txt"
>

Put the file name in quotes.

/Paul
Reply all
Reply to author
Forward
0 new messages