Thread: String Prob

  1. #1
    NoUser
    Guest

    String Prob

    k simple task that i cant figure out :P i have a string stream called 'CP' and all i wanna do is place it in a char[250] array so in other words i need a way of taking single characters from the string stream, any help would be great, thanx

  2. #2
    NoUser
    Guest
    its ok ive sorted it, just used memcopy and copied the complete string stream to a constant character array

  3. #3
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    This should work. Using memcpy is rather dangerous because the stringstream is an actual class, and you don't necessarily know where it actually stores the string relative to the start of the class' memory.
    Code:
    stringstream ss( "this is a test" );
    char x[250];
    ss>>x;
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

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. Calculator + LinkedList
    By maro009 in forum C++ Programming
    Replies: 20
    Last Post: 05-17-2005, 12:56 PM
  3. Linked List Help
    By CJ7Mudrover in forum C Programming
    Replies: 9
    Last Post: 03-10-2004, 10:33 PM
  4. Classes inheretance problem...
    By NANO in forum C++ Programming
    Replies: 12
    Last Post: 12-09-2002, 03:23 PM
  5. creating class, and linking files
    By JCK in forum C++ Programming
    Replies: 12
    Last Post: 12-08-2002, 02:45 PM