Re: Euphoria and fixed field record formats .....

new topic     » goto parent     » topic index » view thread      » older message » newer message

>>>guest at RapidEuphoria.com 11/20 9:46 am >>> 
 
I am new but have used Euphoria very happily and 
effectively for several projects and really like it. 
 
I am interested in how those who have a depth of knowledge do code to 
handle fixed format data records usually viewed as structures as in 
Cobol, Basic etc. 

What is the "right" way to address these values after one has read 
them into a sequence or object that is the result the I/O operation ? 
--------------------

There really isn't one "right" way to handle fixed length records.  Best
practice is generally dictated by what you intend to do.  If you are
looking to interface with an external library (.dll or .so) that
requires structures, your best bet is to search the mailing list
archives for some at length discussions on this topic.  I know win32lib
does a fine job of handling this problem, as well as several other
libraries.  If you simply need to store data that will only be used by a
Euphoria program, I wouldn't even worry about fixed formats.  Your
program will be better written by validating the data at the time of
entry.  The last case, a fixed length record being used by non-Euphoria
programs, will require a bit of special handling.  It should be fairly
simple to write a routine that takes your 4 fields as parameters,
validate them, pad or truncate the lengths (or using sprintf for
numerical fields), and write the resulting data to a file.  I hope I
wasn't too vague.  Good luck.

Michael J. Sabal

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu