Record Count of Flat Files


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Record Count of Flat Files

  1. #1
    Join Date
    May 2004
    Posts
    21

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

    Thanks
    Siva
    Siva

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    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).
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Oct 2005
    Location
    Staffordshire, England
    Posts
    101
    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.

    Martin2k

Similar Threads

  1. need to return total record count, but here is the trick...
    By barbarosa80503 in forum VB Classic
    Replies: 2
    Last Post: 10-28-2005, 03:33 PM
  2. Replies: 0
    Last Post: 07-06-2005, 03:21 PM
  3. Cannot get the record count
    By Sanjay in forum ASP.NET
    Replies: 7
    Last Post: 09-14-2001, 11:31 AM
  4. NullPointerException when reading text file
    By Andrew McLellan in forum Java
    Replies: 3
    Last Post: 05-09-2001, 05:34 PM
  5. reading from flat files
    By Naveen in forum VB Classic
    Replies: 1
    Last Post: 05-23-2000, 07:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center