Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2010-10

ReadStr/WriteStr vs Val/Str

3 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Richard Ward

As a user of the old Macintosh Pascal (later THINK Pascal), both ReadStr and WriteStr functions were included and I used them quite a bit. The names were different but the FPC implementation is basically the same as far as I can tell.

Besides backward compatibility, portability issues and personal preference, is there any functionality Val and Str may have that ReadStr and WriteStr don't? I can't see any, but wanted to make sure there there were no subtle technical issue(s) I might need to consider.

Thank you for implementing these functions.

Reply by email

Paul Nicholls
to Richard Ward

"Richard Ward" wrote in message

As a user of the old Macintosh Pascal (later THINK Pascal), both ReadStr and WriteStr functions were included and I used them quite a bit. The names were different but the FPC implementation is basically the same as far as I can tell.

Besides backward compatibility, portability issues and personal preference, is there any functionality Val and Str may have that ReadStr and WriteStr don't? I can't see any, but wanted to make sure there there were no subtle technical issue(s) I might need to consider.

Thank you for implementing these functions.

Reply by email

Jonas Maebe
to Richard Ward: As a user of the old Macintosh Pascal (later THINK Pascal), both ReadStr and WriteStr…
Richard Ward wrote
As a user of the old Macintosh Pascal (later THINK Pascal), both ReadStr and WriteStr functions were included and I used them quite a bit. The names were different but the FPC implementation is basically the same as far as I can tell. Besides backward compatibility, portability issues and personal preference, is there any functionality Val and Str may have that ReadStr and WriteStr don't? I can't see any, but wanted to make sure there there were no subtle technical issue(s) I might need to consider.

readstr gives a run time error when you try to read an invalid number, while val() returns an error in the last parameter. Other than that, they all use the same helper routines to perform the actual conversions.

Jonas

Reply by email