Thread: need advice again

  1. #1

    Question need advice again

    Need advice here. i have input file that contains data as shown below.
    My program read this data line by line. when it encounter "(3)"
    i want my program to output it as show below in my output file.
    any suggestion command,syntax i must use.

    /* my input file*/
    Page 028 Date 291002 Black 28 23:55:31
    Date 291002 Black 28 Started Transmit, 23:55:40

    /* output file*/

    Page 028 Date 291002 Black 28 23:55:31
    Date 291002 Black 28 Started Transmit, 23:55:40

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Linked lists are your friend. If you don't know how to make one, use the handy dandy search function here, or go to google and search there.

    To save you the head ache, use a double linked list, it'll be a breeze.

    Create a linked list where each node contains a single line. When you are done, you go through your list, or as you're creating, whatever, go back three places, and print that node's data.

    Here's the structure to get you started:
    struct node {
        struct node *prev, *next;
        char * data;
    Read a single line of text from your file, get it's length, malloc that size plus one for the 'data' field, copy it there, continue on your merry way. Hint: fgets() is your friend.

    Hope is the first step on the road to disappointment.

  3. #3

    Smile need advice again2

    quzah can u give me example program?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Advice on C Programming with MSVC++ 2008
    By IT_Guy in forum Windows Programming
    Replies: 1
    Last Post: 03-06-2009, 04:23 AM
  2. game engine advice?
    By stien in forum Game Programming
    Replies: 0
    Last Post: 01-23-2007, 03:46 PM
  3. Resume advice
    By Zughiaq in forum A Brief History of
    Replies: 7
    Last Post: 04-15-2005, 02:16 PM
  4. girl friend advice (prob. the wrong place)
    By B0bDole in forum A Brief History of
    Replies: 15
    Last Post: 10-22-2004, 06:38 PM
  5. Partitioning advice?
    By mart_man00 in forum Tech Board
    Replies: 6
    Last Post: 01-10-2003, 10:53 PM