Hi all Does anyone have any code for converting an octal string to a numeric value? Thanks. Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) Author of: Chief's Installer Pro v5.22.1 for Win32 http://www.bigfoot.com/~African_Chief/chief32.htm Email: African_Chief@bigfoot.com
Prof Abimbola Olowofoyeku wrote:
Does anyone have any code for converting an octal string to a numeric value?
Since `8#42' is the EP notation for octal numbers, you can do ReadStr ('8#' + StringValue, IntegerVar); (It doesn't work with Val instead of ReadStr for "BP compatibility"...) Frank -- Frank Heckenbach, frank@g-n-u.de, http://fjf.gnu.de/ GPC To-Do list, latest features, fixed bugs: http://agnes.dida.physik.uni-essen.de/~gnu-pascal/todo.html
On 10 Sep 00, at 3:52, Frank Heckenbach wrote:
Does anyone have any code for converting an octal string to a numeric value?
Since `8#42' is the EP notation for octal numbers, you can do
ReadStr ('8#' + StringValue, IntegerVar);
Thanks. I'll try that (perhaps you might want to add some octal routines to one of the GPC units)?
(It doesn't work with Val instead of ReadStr for "BP compatibility"...)
:-( I need to do this in a way that will work with other Pascal compilers (but being able to do it with GPC is a good start). Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) Author of: Chief's Installer Pro v5.22.1 for Win32 http://www.bigfoot.com/~African_Chief/chief32.htm Email: African_Chief@bigfoot.com
Prof Abimbola Olowofoyeku wrote:
On 10 Sep 00, at 3:52, Frank Heckenbach wrote:
Does anyone have any code for converting an octal string to a numeric value?
Since `8#42' is the EP notation for octal numbers, you can do
ReadStr ('8#' + StringValue, IntegerVar);
Thanks. I'll try that (perhaps you might want to add some octal routines to one of the GPC units)?
(It doesn't work with Val instead of ReadStr for "BP compatibility"...)
:-( I need to do this in a way that will work with other Pascal compilers (but being able to do it with GPC is a good start).
The above will only work with EP compilers (both `8#' and `ReadStr' are EP features). If it should compile with, say, BP, you'll probably have to "roll your own" since BP contains no support for octal numbers, AFAIK. (Of course, such a solution can easily be written such that it works with most Pascal compilers.) Frank -- Frank Heckenbach, frank@g-n-u.de, http://fjf.gnu.de/ GPC To-Do list, latest features, fixed bugs: http://agnes.dida.physik.uni-essen.de/~gnu-pascal/todo.html
participants (2)
-
Frank Heckenbach -
Prof Abimbola Olowofoyeku