Results 1 to 2 of 2

Thread: Re: File I/O Tutorial

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2009
    Posts
    121

    Re: File I/O Tutorial

    Hi all, in the example where the entire file is read into the arrary,
    Dim strArray() As String
    Open "c:\autoexec.bat" For Input As #1
    strArray = Split(Input(LOF(1), 1), vbCrLf)
    Close #1

    What if I wanted to use only a portion of the contents from the array, how would I set the upper, and lower bounds based on certain text in the array, or file? File is listed below.

    Let's say I only wanted to read the text between, "SHOULDER PUNCH DEFAULTS" and " DURA PUNCH DEFAULTS", how would I do it?

    SHOULDER PUNCH DEFAULTS ******************************
    .006 'DIAMETER GRIND STOCK
    .030 'OAL LENGTH GRIND STOCK
    .015 'SHOULDER THICKNESS GRIND STOCK
    .015 'DEFAULT CORNER RADIUS
    .010 'DEFAULT INSIDE CHAMFER
    .030 'DEFAULT OUTSIDE CHAMFER
    .005 'DEFAULT SHOULDER DIAMETER
    .005 'DEFAULT CORNER BREAK, FRONT

    DURA PUNCH DEFAULTS *************************************
    .006 'DIAMETER GRIND STOCK
    .020 'OAL LENGTH GRIND STOCK
    .010 'SHOULDER THICKNESS GRIND STOCK
    .050 'DEFAULT CORNER RADIUS
    .010 'DEFAULT INSIDE CHAMFER
    10 'DEFAULT OUTSIDE ANGLE
    .005 'DEFAULT SHOULDER DIAMETER
    .005 'DEFAULT CORNER BREAK, FRONT

    BALL LOCK PUNCH DEFAULTS ******************************
    .008 'DIAMETER GRIND STOCK
    .030 'OAL LENGTH GRIND STOCK
    .007 'BALL SEAT RELIEF DEPTH
    .030 'DEFAULT CHAMFER

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: File I/O Tutorial

    Please do not post questions to tutorials or CodeBank threads etc, unless your question is just about what the thread starter posted - I have moved your post (which quotes the entire relevant code) to its own thread in our VB6 forum.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width