Originally posted by: screw3d
You need to give more details on what x_ptr->var is pointing to, and what do you mean by "hang"? Infinite loop?
yes.Originally posted by: glugglug
did you ever hit enter when "typing forever"?
The getline() function is used with input streams, and reads characters into buffer until either:
* num - 1 characters have been read,
* a newline is encountered,
* an EOF is encountered,
* or, optionally, until the character delim is read. The delim character is not put into buffer.
Hitting enter should satisfy #2, so apparently either the newline isn't getting to your program for some weird reason, or there's some kind of a bug somewhere.
Originally posted by: glugglug
Hitting enter should satisfy #2, so apparently either the newline isn't getting to your program for some weird reason, or there's some kind of a bug somewhere.
Enter isn't a newline (LF) character, it is a CR character. Editors do translation of this when creating text files.
Cntrl-J is a newline character.
Originally posted by: Shark_II
I just did an ltrace on the program, and it appears that it does get hung well past this.
I was thrown off because my cout right after the getline() never writes anything.
1 bug covers the other.
sheesh - thanks for the eyes.