Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!sun-barr!apple!well!svc From: svc@well.UUCP (Leonard Rosenthol) Newsgroups: comp.sys.mac.programmer Subject: Re: String functions in Pascal Summary: Why not Munger?? Message-ID: <12264@well.UUCP> Date: 19 Jun 89 02:10:32 GMT References: <1862@dogie.macc.wisc.edu> Distribution: usa Lines: 27 In article <1862@dogie.macc.wisc.edu>, miser@vms.macc.wisc.edu (Dan Miser) writes: > I'm writing a program that concatanates files. However, I cannot > write and read to the disk in 512 bytes because I need to use readln > and writeln (redirected, of course). I need these because I have to > compare string lengths, and check on certain characters inside the > string. But, as you guessed this is too slow. I've thought of > typecasting, but this doesn't want to work. > > So, any ideas how I can write in big blocks while still being able to > compare string like functions to the file? > You are not clear what type of 'string comparision' you need to accomplish but assuming it is nothing THAT complex (like grep-type pattern matching) you might consider using the Munger routine to do the search/compares for you. (IM I p.468). Munger is great for doing search/(and optional replace) in a byte stream (which is what you seem to need to do). Since munger takes a handle to a data stream of ANY length, you can read/write in larger chunks using FSRead/FSWrite. If Munger will not handle the searching/comparisons for you, you can still do large writes by using a buffering scheme and then doing one large write rather than the smaller ones. -- +--------------------------------------------------+ Leonard Rosenthol | GEnie : MACgician Lazerware, inc. | MacNet: MACgician UUCP: svc@well.UUCP | ALink : D0025