Thread: help needed - filtering a data file (with strings?)

  1. #1
    Galligan
    Guest

    help needed - filtering a data file (with strings?)

    Hi
    I have a file as below
    5.537681 3.993655 -5.651005
    1.835011 6.016797 -5.632307
    -2.336837 5.943220 -5.699044

    Now I want to filter it with respect to the end value ie the first one is -5.651005.

    I thought to read each line as a string then decide if the value satified the filter (eg < -5.6) and then write the string to a file, but I couldnt get this to work.

    => How do you use pointers to access part of a string (ie the -5.651005), pass it to a variable as a float??

    I know this is simple, but any advice is gratefully received..... thx EG

  2. #2
    TransparentMember correlcj's Avatar
    Join Date
    Jun 2002
    Posts
    378

    Re: help needed - filtering a data file (with strings?)

    Originally posted by Galligan
    Hi
    I have a file as below
    5.537681 3.993655 -5.651005
    1.835011 6.016797 -5.632307
    -2.336837 5.943220 -5.699044

    Now I want to filter it with respect to the end value ie the first one is -5.651005.

    I thought to read each line as a string then decide if the value satified the filter (eg < -5.6) and then write the string to a file, but I couldnt get this to work.

    => How do you use pointers to access part of a string (ie the -5.651005), pass it to a variable as a float??

    I know this is simple, but any advice is gratefully received..... thx EG
    Try using s sort(). here

    Last edited by correlcj; 11-18-2002 at 10:24 AM.
    "Be formless, shapeless, like water... You put water into a cup, it becomes the cup, you put water into a bottle, it becomes the bottle, you put it in a teapot, it becomes the teapot... Now water can flow, or it can crash, be water my friend."
    -Bruce Lee

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Formatting a text file...
    By dagorsul in forum C Programming
    Replies: 12
    Last Post: 05-02-2008, 03:53 AM
  2. Basic text file encoder
    By Abda92 in forum C Programming
    Replies: 15
    Last Post: 05-22-2007, 01:19 PM
  3. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  4. Please Help Reading Data From A File
    By NickHolmes in forum C Programming
    Replies: 5
    Last Post: 05-29-2005, 11:24 PM
  5. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM