Jim DeMarco
Jdemarco at hshhp.org
Thu Jul 31 10:07:06 CDT 2003
Given that some of us (myself included) don't read files in very often I put together a simple class to read/write text files so I don't have to look up the how to over and over again. Given that, reading a file is as simple as: set oFile = new cFileReader oFile.OpenForRead("c:\test.txt") Do While Not oFile.fEof Debug.Print oFile.ReadLine Loop oFile.closefile 'results in debug window: 'test,hi,bye 'test2,hi2,bye2 Eliminates the confusion of determining the open mode or choosing Print vs. Write vs Input (or Get or Put). Jim DeMarco Director of Product Development HealthSource/Hudson Health Plan -----Original Message----- From: Brett Barabash [mailto:BBarabash at tappeconstruction.com] Sent: Thursday, July 31, 2003 10:08 AM To: 'Access Developers discussion and problem solving' Subject: RE: [AccessD] HTML Email from Access - Progress With all due respect to the OO community, does this really warrant a special text file reader class? I was thinking of something along the lines of: Dim lngIn As Long Dim lngOut As Long Dim strBuffer As String lngIn = FreeFile Open "c:\input.html" For Input As lngIn lngOut = FreeFile Open "c:\output.html" For Output As lngOut Do Until EOF(lngIn) Line Input #lngIn, strBuffer 'Insert any string replacement code here Print #lngOut, strBuffer Loop Close #lngIn Close #lngOut WIth much deference &c. in the absence of JC I shall propose writing (or borrowing) a class :-) There's a lovely text file reader class in ADH2K for reading text files. You can also do it by hand with a little less work, but once you've got the class installed it's a piece of cake. Do yoiu have ADH? Arthur -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Steve Capistrant Sent: July 30, 2003 4:43 PM To: Access Developers discussion and problem solving Subject: RE: [AccessD] HTML Email from Access - Progress Andy, Can you explain just a little more specifics on how you did this: "....Just read it in line by line and built up a string...." Thanks, Steve Capistrant -------------------------------------------------------------------------------------------------------------------- This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the originator of the message. This footer also confirms that this email message has been scanned for the presence of computer viruses. Any views expressed in this message are those of the individual sender, except where the sender specifies and with authority, states them to be the views of Tappe Construction Co. Scanning of this message and addition of this footer is performed by SurfControl E-mail Filter software in conjunction with virus detection software. *********************************************************************************** "This electronic message is intended to be for the use only of the named recipient, and may contain information from Hudson Health Plan (HHP) that is confidential or privileged. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of the contents of this message is strictly prohibited. If you have received this message in error or are not the named recipient, please notify us immediately, either by contacting the sender at the electronic mail address noted above or calling HHP at (914) 631-1611. If you are not the intended recipient, please do not forward this email to anyone, and delete and destroy all copies of this message. Thank You". *********************************************************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030731/5d4cd3db/attachment-0001.html>