replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Am I using CNUM correctly?
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Am I using CNUM correctly?

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
Little-Acorn



Joined: 06 Jul 2008
Posts: 111
Location: San Diego

PostPosted: Wed Apr 20, 2011 6:25 pm    Post subject: Am I using CNUM correctly? Reply with quote

Can I do this?

CHARACTER*250 CDOGGY
INTEGER IDOGGYVAL
CDOGGY="1"
IDOGGYVAL=CNUM(CDOGGY)

I thought this would put the integer value 1 into IDOGGYVAL. But when I try, the entire system crashes and burns. Actually the program is more complicated, but this is the essence.

Is the above code correct? Or is there something wrong that will keep it from running right?

Thanks!
Back to top
View user's profile Send private message
Wilfried Linder



Joined: 14 Nov 2007
Posts: 314
Location: D�sseldorf, Germany

PostPosted: Wed Apr 20, 2011 6:47 pm    Post subject: Reply with quote

CNUM works just in the opposite direction. The second loop in the following code does the same as CNUM:

Code:
program test

integer*4   i
character*2 c,cnum

do i = 1,10
  c = cnum(i)
  print*,c
end do

do i = 1,10
  write(c,'(I2)')i
  print*,adjustl(c)
end do

end

Regards - Wilfried
Back to top
View user's profile Send private message
Little-Acorn



Joined: 06 Jul 2008
Posts: 111
Location: San Diego

PostPosted: Thu Apr 21, 2011 10:16 pm    Post subject: Reply with quote

Wilfried, thanks a lot! This is very helpful!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group