Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. File processing with VB

File processing with VB

Scheduled Pinned Locked Moved Visual Basic
help
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Venkatraman
    wrote on last edited by
    #1

    Hi Folks I have got something for you to think about...the thing is i have a text file which contains huge dataset( delimited records). It has a trailer at the end which will have the record count and other relevant information about the text file. Now i need to verify whether the record count mentioned in the trailer is correct. i am right now doing this by looping through entire file and incrementing the count. The issue is since this is a line by line read operation its taking hell alot of time. These are the questions Is there a way through which we can find how many lines in a file. Is there a way to read the entire file as a stream in VB6.0. Please help me asap Best Regards Venkatraman Kalyanam Chennai - India "Being Excellent is not a skill, it is an attitude"

    L 1 Reply Last reply
    0
    • V Venkatraman

      Hi Folks I have got something for you to think about...the thing is i have a text file which contains huge dataset( delimited records). It has a trailer at the end which will have the record count and other relevant information about the text file. Now i need to verify whether the record count mentioned in the trailer is correct. i am right now doing this by looping through entire file and incrementing the count. The issue is since this is a line by line read operation its taking hell alot of time. These are the questions Is there a way through which we can find how many lines in a file. Is there a way to read the entire file as a stream in VB6.0. Please help me asap Best Regards Venkatraman Kalyanam Chennai - India "Being Excellent is not a skill, it is an attitude"

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      You can use the FileSystemObject to do this.First of all, add a reference to "Microsoft Scripting Runtime". The add the followinf code (more or less) : ********************************************************************** Dim FSys as New FileSystemObject Dim txtStr as TextStream, iLine as Integer Set txtStr = FSys.OpenTextFile (FileName) Do While Not (txtStr.AtEndOfStream) txtStr.SkipLine Loop iLine = txtStr.Line ********************************************************************** This should be faster than reading the whole text file line by line :)

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups