Click here to Skip to main content
16,007,885 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Program not starting Pin
Michael P Butler17-Dec-01 2:48
Michael P Butler17-Dec-01 2:48 
GeneralRe: Program not starting Pin
17-Dec-01 5:31
suss17-Dec-01 5:31 
GeneralCUIntArray & CList Pin
16-Dec-01 8:40
suss16-Dec-01 8:40 
GeneralRe: CUIntArray & CList Pin
Michael Dunn16-Dec-01 9:00
sitebuilderMichael Dunn16-Dec-01 9:00 
GeneralRe: CUIntArray & CList where the error is Pin
16-Dec-01 9:40
suss16-Dec-01 9:40 
GeneralRe: CUIntArray & CList where the error is Pin
16-Dec-01 10:05
suss16-Dec-01 10:05 
GeneralOLE container ambient properties Pin
Paul S16-Dec-01 6:33
Paul S16-Dec-01 6:33 
GeneralProblem With std::getline And C++ Pin
valikac16-Dec-01 4:44
valikac16-Dec-01 4:44 
Hi,
I find there is a slight inconvenience with the std::getline function in C++. Here is an example:

-----------------------------------------------------------
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
using std::getline;

#include <string>
using std::string;

int main()
{
string strTemp;

cout << "Enter a sentence: ";
getline(cin, strTemp);

cout << "\nYou entered: "
<< strTemp << endl;

return 0;
}

-----------------------------------------------------

If you run the code above, and hopefully I did not leave anything out, out will find that after you entered a sentence and press Enter, the "cursor" will go to the next line, but the program does not move onto "You have entered: " until you press Enter the second time. In other words, I have had problems with the getline function in term of having to press Enter twice to get it to move onto the next algorithm.

I have tried for example:

getline(cin, strTemp, '\n');

It has the same effect.

Is there a way to get around having to press Enter twice?

Thanks,
Kuphryn
GeneralRe: Problem With std::getline And C++ Pin
Joaquín M López Muñoz16-Dec-01 10:45
Joaquín M López Muñoz16-Dec-01 10:45 
GeneralRe: Problem With std::getline And C++ Pin
valikac16-Dec-01 16:03
valikac16-Dec-01 16:03 
GeneralReading and Writing Data From ifstream to *STL Container* in *Binary* Pin
valikac16-Dec-01 4:35
valikac16-Dec-01 4:35 
GeneralRe: Reading and Writing Data From ifstream to *STL Container* in *Binary* Pin
Todd Smith16-Dec-01 4:46
Todd Smith16-Dec-01 4:46 
GeneralRe: Reading and Writing Data From ifstream to *STL Container* in *Binary* Pin
valikac16-Dec-01 5:05
valikac16-Dec-01 5:05 
GeneralColor Ramp Pin
Paul Selormey16-Dec-01 1:07
Paul Selormey16-Dec-01 1:07 
GeneralRe: Color Ramp Pin
PJ Arends16-Dec-01 9:37
professionalPJ Arends16-Dec-01 9:37 
GeneralRe: Color Ramp Pin
Daniel Ferguson16-Dec-01 9:40
Daniel Ferguson16-Dec-01 9:40 
GeneralRe: Color Ramp Pin
Rick York16-Dec-01 10:27
mveRick York16-Dec-01 10:27 
GeneralRe: Color Ramp Pin
Serge Baltic16-Dec-01 21:56
Serge Baltic16-Dec-01 21:56 
GeneralRe: Color Ramp-Thanks Pin
Paul Selormey16-Dec-01 13:03
Paul Selormey16-Dec-01 13:03 
QuestionWhich ActiveX controls can i use? Pin
15-Dec-01 23:44
suss15-Dec-01 23:44 
QuestionAre there any News Groups for Linux newbies? Pin
BigMouth15-Dec-01 23:41
BigMouth15-Dec-01 23:41 
AnswerRe: Are there any News Groups for Linux newbies? Pin
Michael Dunn16-Dec-01 8:15
sitebuilderMichael Dunn16-Dec-01 8:15 
GeneralRe: Are there any News Groups for Linux newbies? Pin
BigMouth16-Dec-01 17:53
BigMouth16-Dec-01 17:53 
GeneralRe: Are there any News Groups for Linux newbies? Pin
markkuk17-Dec-01 20:14
markkuk17-Dec-01 20:14 
GeneralRe: Are there any News Groups for Linux newbies? Pin
BigMouth18-Dec-01 17:08
BigMouth18-Dec-01 17:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.