Thread: Finding Values within a text file

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    1

    Finding Values within a text file

    Hi folks,

    I need to extract some data (float) from a text file, and then write it to another text file in a listed format, for example,

    0.000023
    0.000004
    0.395869
    0.565663
    0.999999
    .. etc

    The file I want to extract the data from has the following format, the data required is higlighted in red.

    Packet 1: 00:09:5B:68:ED:4C -> 00:09:5B:2F:B6:74
    Destination Address: 00:09:5B:2F:B6:74
    Source Address: 00:09:5B:68:ED:4C
    Network: Ethernet, Frame type: ETHERTYPE, Protocol: 0x0800 IP
    Frame network size (including 4 bytes CRC): 1518
    Time: 13h:29m 41.411 822s, Diff. time: 0.000000 Date: Sat Dec 06 2003
    IP: 192.168.1.2 -> 192.168.1.1

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    If that record format is consistent then you could simply read until you match "time:". After that the next input is your floating-point value, then you can start over reading until a match for "time:" is found.
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. disposing error
    By dropper166 in forum C# Programming
    Replies: 2
    Last Post: 03-30-2009, 11:53 PM
  2. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  3. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  4. Function is called and I am trying to open a file
    By tommy69 in forum C Programming
    Replies: 88
    Last Post: 05-06-2004, 08:33 AM
  5. what does this mean to you?
    By pkananen in forum C++ Programming
    Replies: 8
    Last Post: 02-04-2002, 03:58 PM