Alright, I cannot get the getline function to work. I have iostream included, using namespace std, and here is the syntax I have down: cin.getline(playerOne, 21);
with playerOne declared previously as a string, and I want its max input to be 20 characters.
What's going on here? It's not working in Dev-C++, and I can't figure out why.
FireSBurnsmuP 0
Posting Whiz in Training
Recommended Answers
Jump to Postthere are two formas of function getline -- one for c-style character arrays and the other for std::string objects. You are trying to use the incorrect one. Here's what you need:
getline(cin,playerOne);
All 3 Replies
Ancient Dragon 5,243
Achieved Level 70 Team Colleague Featured Poster
Clinton Portis 211
Practically a Posting Shark
WolfPack 491
Posting Virtuoso Team Colleague
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.