Line Comparison

This is a discussion on Line Comparison within the C Programming forums, part of the General Programming Boards category; Hey Guys, I have run into a somewhat difficult problem that I am hoping the C gurus out here can ...

  1. #1
    Registered User
    Join Date
    Jun 2010
    Posts
    21

    Unhappy Line Comparison

    Hey Guys,
    I have run into a somewhat difficult problem that I am hoping the C gurus out here can help me. What I am trying to do is a kind of line comparison in two files.
    Both files have lines of numbers in them. What I am trying to do is assign a color to each line in file 1 and then output the other file(with the same number in differnt lines) with the same color.
    So if file 1 is

    1 2 3
    4 5 6

    And file two is

    1
    3
    2 4
    5 6
    then I want the output to be like
    1
    3
    2 4
    5 6

    Is this even possible in C? I am so confused that I am just about ready to call it quits and do actual comparison for the ~ 500 numbers. Please help! Thanks!
    Last edited by hanniballector; 04-28-2011 at 12:46 AM.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    What is it you plan on reading this file in? Rather, what type of file are you making? If you are making an html file or a word doc or something, then yes, you can color text, but it doesn't have anything to do with C. It has to do with whatever program is reading whatever file you are making.


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Jun 2010
    Posts
    21
    OMG Fckkk I had forgotten I could save the results as html. Dude Thank you!!!
    I think this should work.
    1). open two files and save to two arrays
    2). assign a color element to each line in array 1
    3). read every number in array 2 and find where it is in array one. output with <color>number</color>
    4). rinse and repeat

    Dude you are a genius...Thank you!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C/C++ vs assembly: speed comparison
    By Just in forum C++ Programming
    Replies: 11
    Last Post: 11-25-2002, 03:33 PM
  2. Hmmm... Comparison Troubles...
    By Inquirer in forum C++ Programming
    Replies: 7
    Last Post: 10-10-2002, 09:40 PM
  3. Comparison of running times
    By supaben34 in forum C++ Programming
    Replies: 2
    Last Post: 10-06-2002, 09:00 PM
  4. A string comparison function
    By harryp in forum C++ Programming
    Replies: 6
    Last Post: 09-05-2002, 05:55 PM
  5. comparison problems...
    By ronkane in forum C++ Programming
    Replies: 2
    Last Post: 02-17-2002, 11:15 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21