CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2005
    Posts
    26

    Unhappy extract 2/8 fields from space-delim .dat

    I have a .dat file with 8 fields and several hundred records


    ***** time temp ******* ******* ****** ******* ******

    ***** $$$$ $$$$ ****** ******* ****** ******* ******

    $$$$ $$$$

    $$$$ $$$$

    I already know how to open the file and extract the all data (using EOF() loop) into a textbox for printing

    However, now I need to crossplot fields(columns) 2 and 3 with a 2d line MS chart control. Can anyone give me a tip on how to extract coumns 2 and 3 ONLY into separate arrays? Or if someone has an even better algorithm, I would be so grateful!!!

  2. #2
    Join Date
    Dec 2001
    Posts
    6,332

    Re: extract 2/8 fields from space-delim .dat

    If you use the Split() function, you could get an array for each line. Then simply take the elements you want from that. What I'd do, is first load the entire file into a string using Binary mode to access the file. This will avoid looping through the file, thus dramatically speeding up the process. Then Split() the string on vbCrLf, at which point each line will be a seporate element. Splitting each element will give you an array from those, from which you can take the two parts you want.

    Here are a few threads that may be of additional help:
    http://www.codeguru.com/forum/showth...65#post1143218

    http://www.codeguru.com/forum/showth...537#post975537

    http://www.codeguru.com/forum/showth...600#post981600
    Last edited by WizBang; May 20th, 2005 at 03:08 AM.
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  3. #3
    Join Date
    May 2005
    Posts
    26

    Thumbs up Re: extract 2/8 fields from space-delim .dat

    Hey Thanks,
    That was really helpful. That was nice of you

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

Featured