convertion question

This is a discussion on convertion question within the C++ Programming forums, part of the General Programming Boards category; how can i convert variable to another. especially string to char?...

  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    7

    convertion question

    how can i convert variable to another. especially string to char?

  2. #2
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,675
    A string consists of (typically) many characters. How would you propose converting that to a single character? Or do you mean simply to parse the string into its component characters?
    I used to be an adventurer like you... then I took an arrow to the knee.

  3. #3
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,548
    You mean like this?
    Code:
    string str( "Hello World" );
    cout << str.c_str();

  4. #4
    Registered User
    Join Date
    Oct 2007
    Posts
    7
    thats right thanks!!!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Alice....
    By Lurker in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 06-20-2005, 02:51 PM
  2. Debugging question
    By o_0 in forum C Programming
    Replies: 9
    Last Post: 10-10-2004, 05:51 PM
  3. Question about pointers #2
    By maxhavoc in forum C++ Programming
    Replies: 28
    Last Post: 06-21-2004, 12:52 PM
  4. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  5. Question, question!
    By oskilian in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-24-2001, 12:47 AM

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