bug-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-glpk] write error on <stdout> - output buffer overflow


From: xypron
Subject: [Bug-glpk] write error on <stdout> - output buffer overflow
Date: Fri, 6 Nov 2009 12:23:15 -0800 (PST)

Hello Andrew,

the following model returns an error
"write error on <stdout> - output buffer overflow"

for {i in 1..2000}
  printf "%6s", "x";
end;

Currently the output buffer is only flushed when reaching a new line.

For very long output lines the buffer should be flushed instead of
throwing an error.

The problem is in write_char (file glpmpl04.c)

The following change should resolve it.

Please, replace 
         if (mpl->out_cnt == OUTBUF_SIZE)
            error(mpl, "write error on %s - output buffer overflow",
               mpl->out_file);
by
         mpl->out_buf[mpl->out_cnt++] = (char)c;
         if (mpl->out_cnt == OUTBUF_SIZE - 1)
         {  mpl->out_buf[mpl->out_cnt] = '\0';
            if (mpl->out_fp == stdout)
               xprintf("%s", mpl->out_buf);
            else
               fprintf(mpl->out_fp, "%s", mpl->out_buf);
            mpl->out_cnt = 0;
         }

Best regards

Xypron

-- 
View this message in context: 
http://old.nabble.com/write-error-on-%3Cstdout%3E---output-buffer-overflow-tp26230888p26230888.html
Sent from the Gnu - GLPK - Bugs mailing list archive at Nabble.com.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]