Hello guies please help me
how can I typecast string to char
san_sarangkar
0
Newbie Poster
Recommended Answers
Jump to Postyou can't because you can't stuff a whole string into a single character. If this is about some error message you got, then post the error message along with the code you wrote.
Jump to PostA string cannot be cast to a char, because a char is one byte and a string can be any number of bytes. You can, however, use std::string's c_str member and create a const char* out of your string.
string s = "hi"; const char *cs = …
All 6 Replies
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
ninwa
0
Newbie Poster
stilllearning
148
Posting Whiz
san_sarangkar
0
Newbie Poster
ninwa
0
Newbie Poster
stilllearning
148
Posting Whiz
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.