Record Count of Flat Files
Is there an easy way to find the number of records in a flat file (VB6) instead of opening it and keepin a counter as we read records? Any help will be appreciated.
If the records are fixed-length, you may divide the file length (LOF or FileLen functions) by the record length to determine the number of records. If the records are variable-length, you may read the file in chunks of, say, 64K bytes and use InStr to count the number of end-of-record markers (e.g., vbCr).
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
It depends on how these records are stored, one per line, then just do a line count.
I've been programming with VB for 15 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
By barbarosa80503 in forum VB Classic
Last Post: 10-28-2005, 03:33 PM
By terryb in forum VB Classic
Last Post: 07-06-2005, 03:21 PM
By Sanjay in forum ASP.NET
Last Post: 09-14-2001, 11:31 AM
By Andrew McLellan in forum Java
Last Post: 05-09-2001, 05:34 PM
By Naveen in forum VB Classic
Last Post: 05-23-2000, 07:36 PM
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL