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 > Re: Distingui**...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 15 Topic 8159 of 8775
Post > Topic >>

Re: Distingui****ng between characters and numbers

by Arjen Markus <arjen.markus@[EMAIL PROTECTED] > Apr 22, 2008 at 02:06 AM

On 22 apr, 10:53, SimonG <si...@[EMAIL PROTECTED]
> wrote:
> I have built the following program with both ifort (Intel) and g95 but
> they yield different results:
>
> program ex
> =A0 implicit none
> =A0 real(8) :: x
> =A0 integer :: n
> =A0 character(10) :: buff
>
> =A0 do
> =A0 =A0 =A0write(6,'(a)',advance=3D'no') '> '
> =A0 =A0 =A0read(5,*) buff
> =A0 =A0 =A0read(buff,*,err=3D900) x
> =A0 =A0 =A0write(6,'(2a)') 'Number:',trim(buff)
> =A0 =A0 =A0cycle
> 900 =A0continue
> =A0 =A0 =A0write(6,'(2a)') 'Command:',trim(buff)
>
> =A0 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

With list-directed input a bare / ends the input, as you know. Put it
in '' or "" and it should work.

I do not know the answer to your other question though, but such edge
cases might indeed be ambiguously (or not at all) treated in the
standard.

Regards,

Arjen
 




 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 Mon Oct 13 8:50:24 CDT 2008.