Silverfrost Forums

Welcome to our forums

Non-numeric characters output by %wf

24 Nov 2010 12:01 #7146

Specifically, the following line:

          iodial = winio@ ('%ff%nl%cn%6.2wf&', paltot)

whose only purpose is to confirm that a set of numbers that ought to add up to 100 actually do so, is currenly producing one of two possible outputs to the screen: usually 100.00, and occasionally 100.0x, where x appears to be char(148). At any rate, it is non-numeric; it is a lower case o with something over the top that my eyes are unable to resolve without fiddling around with text size.

Can anyone suggest why this might be happening (needless to say, I imagine the chances of reproducing this in a small test app are negligible)? %wf is pretty fundamental so I don't seriously believe there is a bug associated with it. The only thing I can think of is some sort of memory corruption caused by my own code, but if so it's unwittingly very *targeted *:D

24 Nov 2010 12:13 #7148

Try using:

      character*6 paltot_c

      write(paltot_c,100)paltot
  100 format(f6.2)

      iodial = winio@ ('%ff%nl%cn%6ws&', paltot_c)

Regards Ian

24 Nov 2010 12:18 #7150

Um, OK ... you have a good reason for thinking my line of code is dodgy?

24 Nov 2010 1:09 #7152

Actually, I think it might be %wf that is dodgy, or maybe something to do with Windows. Try it on another machine.

You could also try a %rf - you loose the nice formatting but you can update the value without rewriting the whole window. I usually use %rs and write to the character variable as in my other suggestion.

Ian

25 Nov 2010 8:57 #7154

%wf will use the C function sprintf with %f and I guess that this function is not always able to squeeze the given number into the desired format.

Please login to reply.