On Saturday, December 15, 2012 12:00:07 Greg Watson wrote:
> Christoph,
>
> Good point. There are a lot of factors involved in getting the output to the
> Eclipse console, which I won't go into here. Suffice to say that combining
> both buffered and un-buffered I/O in this way is bound to cause issues like
> this. You could try using printf or fputc instead of write to confirm.
>
> Regards,
> Greg
Greg,
I can confirm that the following program doesn't show the error.
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
char buf[] = "abcdefghij";
int main(int argc, char* argv[]) {
int num_repeats = 1;
int i;
/* Inspect the command line for arguments */
if ( argc > 1 ) {
num_repeats = atoi(argv[1]);
}
for (i=0; i<num_repeats; i++) {
if (EOF == fputs(buf, stdout) ) {
puts("Error in writing buffer: \n");
}
}
return EXIT_SUCCESS;
}
On the other hand (as you might have imagined) this is not the original program but derived from libhdf5 (as I was told). It might be difficult to change it there (i.e. at http://www.hdfgroup.org/HDF5/ ), or even worse, hunt down all libhdf5 copies with write rather than fputs around the world.
--
Mit freundlichen Grüßen / Kind regards
Dr. Christoph Pospiech
High Performance & Parallel Computing
Phone: +49-351 86269826
Mobile: +49-171-765 5871
E-Mail: christoph.pospiech@xxxxxxxxxx
-------------------------------------------------------------------------------------------------------------------------------------------
IBM Deutschland GmbH / Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführung: Martina Koederitz (Vorsitzende), Reinhard Reschke, Dieter Scholz, Gregor Pillen, Joachim Heel, Christian Noll
Sitz der Gesellschaft: Ehningen / Registergericht: Amtsgericht Stuttgart, HRB 14562 / WEEE-Reg.-Nr. DE 99369940
|