Thread: number of couloumbs function need help:(

  1. #1
    Registered User
    Join Date
    Mar 2008
    Posts
    53

    number of couloumbs function need help:(

    Hey guys I just wanted to know if there is a way to make a function return the number of rows in a 2 coloumb table of numbers in a txt file. thanx in advance

  2. #2
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,337
    Yes, there is a way.
    Mainframe assembler programmer by trade. C coder when I can.

  3. #3
    Registered User
    Join Date
    Mar 2008
    Posts
    53
    HOW???

  4. #4
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Depends, does the file contain the columns on each line? ie already formatted.

    Or is it just a list of numbers? If it's the latter, count the valid lines/numbers (fgets() maybe...) and divide by 2 (columns per row). Otherwise just count the number of lines (if it's the former). You might also want to validate each line, so you don't count empty/invalid lines.

  5. #5
    Registered User
    Join Date
    Mar 2008
    Posts
    53
    I can do it the divide by 2 way but how can i make it so the comp knows when to stop counting

  6. #6
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    When you run out of data.

  7. #7
    Registered User
    Join Date
    Mar 2008
    Posts
    53
    still cant get it to work!

  8. #8
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Do you know how to tell when you are out of data?

  9. #9

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. doubt in c parser coding
    By akshara.sinha in forum C Programming
    Replies: 4
    Last Post: 12-23-2007, 01:49 PM
  2. Issue w/ Guess My Number Program
    By mkylman in forum C++ Programming
    Replies: 5
    Last Post: 08-23-2007, 01:31 AM
  3. Replies: 16
    Last Post: 10-29-2006, 05:04 AM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. Creating a student grade book-how?
    By Hopelessly confused in forum C Programming
    Replies: 5
    Last Post: 10-03-2002, 08:43 PM