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 

ENCODE AND DECODE

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



Joined: 13 May 2008
Posts: 14

PostPosted: Tue May 20, 2008 6:58 pm    Post subject: ENCODE AND DECODE Reply with quote

How can I convert numbers to character strings
(and vice-versa)?
I used to use ENCODE and DECODE but I don't dee these in the help. Sad
For example looking at a hex dump I have the following two bytes
32 38 i.e. 28 I need an integer with 28.
Back to top
View user's profile Send private message
JohnHorspool



Joined: 26 Sep 2005
Posts: 270
Location: Gloucestershire UK

PostPosted: Tue May 20, 2008 8:16 pm    Post subject: Reply with quote

I don't think that ENCODE and DECODE were ever part of the fortran standard. I remember they were VAX extensions. Certainly on the VAX they were equivalent to an internal read and write, where instead of reading from and writing to a unit number a character string variable replaced the unit number. This is part of the fortran standard.

READ(character_string_variable,*)K

and

WRITE(character_string_variable,'(ICool')K
Back to top
View user's profile Send private message Visit poster's website
JohnHorspool



Joined: 26 Sep 2005
Posts: 270
Location: Gloucestershire UK

PostPosted: Tue May 20, 2008 8:18 pm    Post subject: Reply with quote

came out wrong !

Code:
READ(character_string_variable,*)K


WRITE(character_string_variable,'(I8)')K
Back to top
View user's profile Send private message Visit poster's website
IanLambley



Joined: 17 Dec 2006
Posts: 490
Location: Sunderland

PostPosted: Tue May 20, 2008 11:09 pm    Post subject: Reply with quote

Here are some examples on other websites:
http://gcc.gnu.org/onlinedocs/gcc-3.1.1/g77/ENCODE-and-DECODE.html
and
http://docs.hp.com/cgi-bin/doc3k/B3150190021.12118/44
http://docs.hp.com/cgi-bin/doc3k/B3150190021.12118/36

In your case for two characters, you will need the I2 format in the read statement described by John
Regards

Ian
Back to top
View user's profile Send private message Send e-mail
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Tue May 20, 2008 11:22 pm    Post subject: Reply with quote

I have a feeling that they were more than VAX-only extensions, and existed prior to the VAX. You can also give the statement number of a format statement if you wish.

E
Back to top
View user's profile Send private message
j clark



Joined: 29 Mar 2008
Posts: 20
Location: Bala Cynwyd (Pennsylvania)

PostPosted: Thu May 22, 2008 7:45 pm    Post subject: ENCODE and DECODE trivia Reply with quote

Actually, ENCODE and DECODE go back much farther than VAX/VMS.
Before there was even a Digital Equipment Corp. The oldest implementation I am aware of was as library routines on the IBM 1620. That would be circa 1960, but it may be even older.
Back to top
View user's profile Send private message AIM Address
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