| View previous topic :: View next topic |
| Author |
Message |
sparge
Joined: 11 Apr 2005 Posts: 371
|
Posted: Wed Nov 24, 2010 1:01 pm Post subject: Non-numeric characters output by %wf |
|
|
Specifically, the following line:
| Code: |
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  |
|
| Back to top |
|
 |
IanLambley
Joined: 17 Dec 2006 Posts: 514 Location: Sunderland
|
Posted: Wed Nov 24, 2010 1:13 pm Post subject: |
|
|
Try using:
| Code: |
character*6 paltot_c
write(paltot_c,100)paltot
100 format(f6.2)
iodial = winio@ ('%ff%nl%cn%6ws&', paltot_c)
|
Regards
Ian |
|
| Back to top |
|
 |
sparge
Joined: 11 Apr 2005 Posts: 371
|
Posted: Wed Nov 24, 2010 1:18 pm Post subject: |
|
|
| Um, OK ... you have a good reason for thinking my line of code is dodgy? |
|
| Back to top |
|
 |
IanLambley
Joined: 17 Dec 2006 Posts: 514 Location: Sunderland
|
Posted: Wed Nov 24, 2010 2:09 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8283 Location: Salford, UK
|
Posted: Thu Nov 25, 2010 9:57 am Post subject: |
|
|
| %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. |
|
| Back to top |
|
 |
|