TIP: Click on subject to list as thread! ANSI
echo: delphi
to: BRYAN SMITH
from: PETER COLLIS
date: 1996-05-27 11:12:00
subject: Help

While listening to Bryan Smith Pete heard:Help
G'day Bryan
 PC> I think the way Pascal handles text files could be better done.
 BS> What's the problem ?
New Delphi user syndrome more than anything else :-) 
I'm converting a DOS utility written in MS Basic 7 to Delphi, The
program takes a parts pricelist and compares the part number of each
item against a list of numbers exported from a database and after
doing calculations on tax rates etc it builds two d'limited ascii
files for import into the database, one file contains new parts not
present that are to be added the other contains parts that are in the
database but the prices of the parts need updating.
Now the partnumbers of parts in the database are exported as text
"each line has cr/lf at end" i'm converting this file to a fixed
record length random access file so i can run a binary search routine
on it to check if the part from the new pricelist is already in the
database or not.
Now what i wanted to do but couldn't was to get the filesize as well
as the file pointer position so i could update a bar graph as the file
was converted to fixed length, these functions existed for files
opened with the FileOpen()/FileCreate() functions but not for
streaming routines using Read/Readln Write/Writeln calls, i ended up
overcoming it by first opening the input text file using FileOpen()
then doing a seek to the end of the file to get it's size closing it
and re-opening it as a textfile, to get the file pointer position i
just used a longint and added the length of each line read +2 to it.
   -=Pete=-
--- OMX/Blue Wave v2.12
---------------
* Origin: Gates of Hell (3:713/914.16)

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™.