[fpc-pascal] Re: put data to stdout (fpc vs. gcc)

fpc at xgelb.de fpc at xgelb.de
Thu Jun 21 19:12:16 CEST 2007


Hi

I try your solutions and here are the results:

1.) TIP: set text buffer higher (using settextbuf) -> RESULT: procedure breaks later
2.) TIP: use flush() after writeln() -> RESULT: procedure breaks on first flush()
3.) TIP: convert first float to text and then put it out -> RESULT: the same breaks like the writeln()-included formating
4.) TIP: use sprintf form libc unit -> RESULT: not tested, because the file descriptors change(, isn't?)
5.) TIP: write your own writeln() -> RESULT: not tested, because is to difficult but very interesting


Here an information again: If I put the output  with all informations and high precision to /dev/null nothing breaks.

My solution is: I write only one information and I cut the precision like writeln(stdout,out1:0:3). This works fine.

Thank's  at all for your help!

regards,
Markus

--------------
C source:

for (i=0;i<n;i++) {
  out1=(single) libout1[i];
  out2=(single) libout2[i];
  count+=1;
  printf("%20.0f%15.5f%15.5f\n",count,out1,out2);}

--------------
fpc source:

for i:=0 to n do
begin
  out1:=single(libout1[i]);
  out2:=single(libout2[i]);
  inc(count);
  writeln(stdout, count:20, out1:15:5, out2:15:5); (* This will break! *)
end;

--------------




More information about the fpc-pascal mailing list