when to use a class

This is a discussion on when to use a class within the C++ Programming forums, part of the General Programming Boards category; Okay, I have a function written that will read a file and output the file with the length of each ...

  1. #1
    DMaxJ
    Guest

    when to use a class

    Okay,

    I have a function written that will read a file and output the file with the length of each line. I want to parse each line until I get a specific character, then continue to read the line until the end of the line.

    I have each line when used, stored in a string. Should I try to implement a class to parse the string? Or is there an easier way to do this???


    Thanks

  2. #2
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    I suppose you could use a class to hide the "tokenize" part. class FileLine or something. Sure, why not.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  3. #3
    DMaxJ
    Guest

    Arrow let me try again

    Let's see:

    What I really want to do is to make a new file that will have the previous character string on the left side or the "token". Next I want to continue to read the same string. Next, I want to break the right side into smaller parts between white space characters and print a new line with the left side, token, right side.

    Example:


    Input file:
    ------------
    12 ? a g e



    This is my desired output:
    --------------------------------

    12 ? a
    12 ? g
    12 ? e

    Thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Class design problem
    By h3ro in forum C++ Programming
    Replies: 10
    Last Post: 12-19-2008, 09:10 AM
  2. Two conceptual questions
    By AntiScience in forum C++ Programming
    Replies: 3
    Last Post: 11-01-2007, 12:36 PM
  3. Defining derivated class problem
    By mikahell in forum C++ Programming
    Replies: 9
    Last Post: 08-22-2007, 03:46 PM
  4. matrix class
    By shuo in forum C++ Programming
    Replies: 2
    Last Post: 07-13-2007, 02:03 AM
  5. Abstract class problem
    By VanJay011379 in forum C++ Programming
    Replies: 9
    Last Post: 07-31-2002, 02:30 PM

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