TIP: Click on subject to list as thread! ANSI
echo: clipper
to: TOMASZ PADZIK
from: ERIK WACHTMEESTER
date: 1998-04-10 21:06:00
subject: Text File

Reply-To: erik.wachtmeester@bighole.iaf.nl
Tomasz Padzik wrote in a message to Ben Cavanagh:
 TP> FUNCTION ReadLn(nHandle)
Nice one! Why didn't I ever think of using at() and fseek() to implement a
universal readln() function? ;-) If you don't mind I'll use this idea in my 
own
library...
There's only one thing I would never use in my code:
 TP>   local lcText := FREADSTR(nHandle,DEF_BUFFER_SIZE)
 TP>   if empty(lcText)
 TP>     lcRet = NIL
lcRet (I would have called it cReturn, but that's a matter of habit, I assume
'l' is for local?) implies a character value, and I would never assign NIL to
it. Instead I would set it to space(0) and let the calling routine check for
!empty().
If a return value could be of several types (including NIL), I would use
uReturn as it's variable name.
I know Clipper doesn't mind, but I do. But then again, I'm coding a lot of
Pascal lately, one of the strictest languages ever. Probably that's got
something to do with it... ;-)
And one more thing:
 TP>        fseek(nHandle,lnPos+1-len(lcText),FS_RELATIVE)
 TP>        lcRet = substr(lcText,1,lnPos-1)
You're assuming that DEF_NEW_LINE is 2 chars long, but since it's a #defined
string, you never can be sure.
I know, I'm nitpicking... ;-)
Regards,
Erik 
--- ifmail v.2.13-tx8.7
---------------
* Origin: May it be on this earth? (2:283/7.2)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.