String Question

This is a discussion on String Question within the C++ Programming forums, part of the General Programming Boards category; How to copy a string to array string spare with space? Thank you ! string ="TOM MARY PETER JOHN"; change ...

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    101

    String Question

    How to copy a string to array string spare with space?

    Thank you !
    string ="TOM MARY PETER JOHN";
    change to
    *s[0] = "TOM"
    *s[1] = "MARY"
    *s[2] = "PETER"
    *s[3] = "JOHN"

    can anyone give me an example? thx!!

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    look up strtok() in your help files.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    Registered User
    Join Date
    Oct 2001
    Posts
    101
    thx!!~
    Last edited by DramaKing; 01-25-2002 at 08:01 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. char Handling, probably typical newbie stuff
    By Neolyth in forum C Programming
    Replies: 16
    Last Post: 06-21-2009, 04:05 AM
  2. Reusing a string pointer question
    By chiefmonkey in forum C++ Programming
    Replies: 3
    Last Post: 05-06-2009, 04:53 PM
  3. Program using classes - keeps crashing
    By webren in forum C++ Programming
    Replies: 4
    Last Post: 09-16-2005, 03:58 PM
  4. String array question
    By gogo in forum C++ Programming
    Replies: 6
    Last Post: 12-08-2001, 05:44 PM

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