would a class suit?

This is a discussion on would a class suit? within the C++ Programming forums, part of the General Programming Boards category; Let's see: What I really want to do is to make a new file that will have the previous character ...

  1. #1
    Registered User
    Join Date
    Sep 2002
    Posts
    35

    Arrow would a class suit?

    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

  2. #2
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    I see that as a single method. The classes that I might see are for the two files. a class that represents format 1 and a class that represents format two. you could get the info out of one and put it in the other through some standard methods.

    just an idea.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  3. #3
    Registered User
    Join Date
    Sep 2002
    Posts
    35

    okay - but...

    Thanks...

    Well, I guess the next question, is do I define my method in the class that generates the output?

    Also, can I pass a string parameter to a class?


    Thanks again.

  4. #4
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    ya, that's kinda what I'm thinking

    file1.GetData(blah);
    file2.SaveData(blah);

    file1 is an object that reads it in from the original format, file2 is one that writes it in the new format.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  5. #5
    Registered User
    Join Date
    Sep 2002
    Posts
    35

    extracting chars from strings

    Well, how can I traverse the string that I want to pass to the class... Should I use pointers or is there a predefined method that could handle this feat...

    Thanks

    I guess I will have to write the method, unless one exist...

  6. #6
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    strtok()
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Bitwise Unwanted Output
    By pobri19 in forum C++ Programming
    Replies: 4
    Last Post: 09-15-2008, 05:07 AM
  2. matrix class
    By shuo in forum C++ Programming
    Replies: 2
    Last Post: 07-13-2007, 02:03 AM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 03:39 PM
  4. Need help to build network class
    By weeb0 in forum C++ Programming
    Replies: 0
    Last Post: 02-01-2006, 11:33 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