hi,
I know xharbour has functions:
hfile:=hb_Fuse("ccc.txt")
while !hb_feof()
c1:=hb_freadln()
hb_fskip(1)
end
hb_fuse()
fclose(hfile)
but harbour without.
Are there lists of what functions each harbour libs files includes ?
Regards!
Shuming Wang
What is the best way read a txt file?
-
- Posts: 454
- Joined: Sun Oct 30, 2005 6:37 am
- Location: Guangzhou(Canton),China
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
-
- Posts: 167
- Joined: Thu Mar 22, 2007 11:24 am
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
-
- Posts: 56
- Joined: Mon Jul 03, 2006 2:34 am
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Colin,
> RE.prg uses TTxtFile
Thats an old version of samples\RE.prg. The current RE.prg sample does not use TTxtFile and does it in a total different way:
ExtractLine() is a new FWH function
> RE.prg uses TTxtFile
Thats an old version of samples\RE.prg. The current RE.prg sample does not use TTxtFile and does it in a total different way:
Code: Select all
cTxtFile = MemoRead( cRCFile )
nFrom = 1
while nFrom < Len( cTxtFile )
cLine = ExtractLine( cTxtFile, @nFrom )
...
SysRefresh()
end
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
If we know we are dealing with a text file containing fixed width lines
Extractline from FWH and the above code are enough to deal with text files containing variable length lines or fixed width lines.
If we like OOPS we can put the same code in a class.
Code: Select all
for nFrom := 1 to nSize step nLineWidth
cline := substr( ctext, nfrom, nlinewidth )
next
to extract a particular line number :
cline := substr( ctext, ( nlinenumber- 1 ) * nlinewidth + 1, nlinewidth )
If we like OOPS we can put the same code in a class.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India