Board index » delphi » scanf for TPascal

scanf for TPascal

Hi I search a TPU whose let me use the ANSI-C Standards like
sscanf, printf etc. Is there such a thing anywhere???
(I realy dont like the val command)

--
Tilo

 

Re:scanf for TPascal


In <6j6v66$bj...@rks1.urz.tu-dresden.de>,

Quote
Tilo Wuensche <wuens...@iee1.et.tu-dresden.de> wrote:
> Hi I search a TPU whose let me use the ANSI-C Standards like
> sscanf, printf etc. Is there such a thing anywhere???
> (I realy dont like the val command)

Well, such a procedure can't be written in Pascal since it takes a
variable number (and types) of arguments. However, depending on the
compiler you use, it might be possible to call such C functions -- e.g.
GNU Pascal allows calling C functions with varargs, but not declaring
such procedures in Pascal).

What I prefer is ReadStr and WriteStr from the Extended Pascal Standard.
They work like Read[ln] and Write[ln], only with a string as source/
destination. Any compiler conforming to the standard supports them.
Besides, for Turbo Pascal, I wrote a little WriteStr hack (see my web
page) which is not exactly like WriteStr (as I said, this is impossible
in Pascal), but quite close. Something like ReadStr should be similar.

--
Frank Heckenbach, frank@[NOSPAM.REMOVE.THIS]pascal.gnu.de
Internet links:  http://fjf.gnu.de/
Pascal programs: http://fjf.gnu.de/programs.html (including BP Crt.Delay fix)
PGP keys: http://pgp5.ai.mit.edu/pks/lookup?op=index&search=Frank+Heckenbach

Other Threads