   std::string to c-style string [solved, many thanks]
  Now, normally I would just use std::string, but in this case I need to store to a char queue. This is my function right now://buffer = queue<char>bool InputMan::scanline(){char c[80];std::string m;getline(cin, m);//need to put m into c somehow (should I use .c_str()?//I tried it, but I couldn't figure it out//anyway, a method for storing the contents of m into c is needed!for(int i =0; i == 80; i++){   buffer.push(c);}return true;} [Edited by - Plasmarobo on July 27, 2006 6:21:48 PM]
  You can use strcpy() or strncpy() if your compiler has it.   ;  what is the syntax of said Strcpy?strcpy(std::string, char buf[])?Something like that?   ;  Can't you just take the characters directly from m and put them into buffer?   ;  yes, usestrcpy( buffer, myString.c_str() );   ;  How DO you access the characters in an std::string object?   ;Quote:Original post by peousyes, usestrcpy( buffer, myString.c_str() );A more safe alternative would be (requires <cstring> and <string>):std::string in = "test";char out[80];std::strncpy( out, in.c_str(), in.length()+1 );Remember that both strncpy and strcpy is in namespace std.Quote:How DO you access the characters in an std::string object?You either get a constant array of characters using string::c_str() or you access them invdividually with operator[].   ;  Thanks! that is all I needed!   