Thread: FIle tokenize?

  1. #1
    Registered User
    Join Date
    May 2004

    FIle tokenize?


    I would like to 'tokenize' a file with a delimiter....for example:

    Input File:


    and would like to tokenize it so that for the first line i get: "90" "43" "37" "58" which can be in turn inputted into an array.

    How can i split the numbers up using the delimter ":" on each line?


  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    The easiest way would be to use Boost.Tokenizer from the Boost libraries.
    All the buzzt!

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    Registered User
    Join Date
    Mar 2002
    You could also use strtok(), with appropriate delimiter(s) or you could write your own function, for the practice. I've also seen reports of using a series of >> like---cin >> num1 >> dummy >> num2 >> dummy....

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need Help Fixing My C Program. Deals with File I/O
    By Matus in forum C Programming
    Replies: 7
    Last Post: 04-29-2008, 07:51 PM
  2. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 03:39 AM
  3. archive format
    By Nor in forum A Brief History of
    Replies: 0
    Last Post: 08-05-2003, 07:01 PM
  4. Making a LIB file from a DEF file for a DLL
    By JMPACS in forum C++ Programming
    Replies: 0
    Last Post: 08-02-2003, 08:19 PM
  5. Need a suggestion on a school project..
    By Screwz Luse in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 02:58 AM