Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Fortran > Distingui****ng...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 15 Topic 8159 of 8551
Post > Topic >>

Distingui****ng between characters and numbers

by SimonG <simon@[EMAIL PROTECTED] > Apr 22, 2008 at 01:53 AM

I have built the following program with both ifort (Intel) and g95 but
they yield different results:

program ex
  implicit none
  real(8) :: x
  integer :: n
  character(10) :: buff

  do
     write(6,'(a)',advance='no') '> '
     read(5,*) buff
     read(buff,*,err=900) x
     write(6,'(2a)') 'Number:',trim(buff)
     cycle
900  continue
     write(6,'(2a)') 'Command:',trim(buff)

  end do

end program ex

On the Intel version entering '+' results in 'Command:+' whereas with
the g95 version the result is 'Number:+'. I expected the Intel result
but perhaps the standard is ambiguous on this. Is this a g95 bug?

A second question: how do I enter a '/' character?

Thanks,

Simon Geard
 




 15 Posts in Topic:
Distinguishing between characters and numbers
SimonG <simon@[EMAIL P  2008-04-22 01:53:23 
Re: Distinguishing between characters and numbers
Arjen Markus <arjen.ma  2008-04-22 02:06:39 
Re: Distinguishing between characters and numbers
fj <francois.jacq@[EMA  2008-04-22 02:07:06 
Re: Distinguishing between characters and numbers
"FX" <couder  2008-04-22 09:12:57 
Re: Distinguishing between characters and numbers
"FX" <couder  2008-04-22 09:12:57 
Re: Distinguishing between characters and numbers
SimonG <simon@[EMAIL P  2008-04-22 03:09:19 
Re: Distinguishing between characters and numbers
Gordon Sande <g.sande@  2008-04-22 12:22:53 
Re: Distinguishing between characters and numbers
Gary Scott <garylscott  2008-04-22 07:36:41 
Re: Distinguishing between characters and numbers
Gordon Sande <g.sande@  2008-04-22 14:20:51 
Re: Distinguishing between characters and numbers
glen herrmannsfeldt <g  2008-04-22 10:38:37 
Re: Distinguishing between characters and numbers
Dick Hendrickson <dick  2008-04-22 12:42:17 
Re: Distinguishing between characters and numbers
nospam@[EMAIL PROTECTED]   2008-04-22 08:38:07 
Re: Distinguishing between characters and numbers
glen herrmannsfeldt <g  2008-04-22 08:33:04 
Re: Distinguishing between characters and numbers
Dick Hendrickson <dick  2008-04-23 00:26:24 
Re: Distinguishing between characters and numbers
SimonG <simon@[EMAIL P  2008-04-22 06:18:08 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 17:02:25 CDT 2008.