Public Group

Archived

This topic is now archived and is closed to further replies.

skipping a code of line

This topic is 5221 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

// global variable

char *sName[ 1 ];
//

...
....

void set_characterNameAgeSex()
{
char setName[ 50 ];
char *sTransfer;
short setSex;
short setAge;

// set name

cout << "Enter a name for your character(50 char. max): ";
cin.getline( setName, 49 );

sTransfer = setName;
sName[ 0 ] = sTransfer;

I can't figure out why the program is skipping the line: cin.getline( setName, 49 ); It print the cout before that but skips user input.... Please help. Thanks in advance for replies.... EDIT: whoops! Title should be: Skpping a line of code. lol. [edited by - TheOne1 on June 4, 2004 11:08:05 PM]

Share on other sites
Are you using MSVC 6? If you are, there''s a known bug in basic_istream::getline() with MSVC 6. Try applying the fix at this page and see if it solves your problem.

Share on other sites
Thanks, but I've applied that fix many times, and I just did it again, but nothings changed. It still skips the cin.getline line.

Any other suggestions?

edit: Ok, on the fixes page, it says to replace snextc with sbumpc but since I have VC++ 6.0, I changed to to stossc. Do I change just that one line, or should I change all the snextc's to stossc?

also, in my file, there is a line like this:
else if (_Tr::eq((_E)_C, _D))
but the fixes page has the line like this:
else if (_Tr::eq(_C, _D))

should I change it or leave it?

[edited by - TheOne1 on June 4, 2004 11:38:19 PM]

[edited by - TheOne1 on June 4, 2004 11:45:57 PM]

Share on other sites
quote:
Original post by TheOne1
Ok, on the fixes page, it says to replace snextc with sbumpc but since I have VC++ 6.0, I changed to to stossc.

Umm...this fix is specifically for VC++ 6.0... so you should probably replace snextc with sbumpc, not stossc. Uhh...wow, what a concept, doing something other than what it tells you to and wondering why it doesnt work.

"I am free of all prejudices. I hate everyone equally." - W. C. Fields

[edited by - Lord Hen on December 2, 2008 2:32:49 AM]

Share on other sites
quote:
Original post by Lord Hen
quote:
Original post by TheOne1
Ok, on the fixes page, it says to replace snextc with sbumpc but since I have VC++ 6.0, I changed to to stossc.

Umm...this fix is specifically for VC++ 6.0... so you should probably replace snextc with sbumpc, not stossc. Uhh...wow, what a concept, doing something other than what it tells you to and wondering why it doesnt work.

"I am free of all prejudices. I hate everyone equally." - W. C. Fields

[edited by - Lord Hen on December 2, 2008 2:32:49 AM]

....its amazing how people can be rude to each other (subtly or not) when they don't see each other face to face.

Anyways, if you see on the fixes page it says:
Note that V6.0 replaces snextc with stossc. It is an adequate fix, but you can also apply the above patch safely.

I know it doesnt say replace with stossc, but when I checked it, it was snextc instaed of stossc.

[edited by - TheOne1 on June 5, 2004 3:19:58 PM]

Share on other sites
Since you seem to like to make things more complicated than they are, I suggest replacing the dinkumware implementation of STL with STLport. Problem solved.

[My site|SGI STL|Bjarne FAQ|C++ FAQ Lite|MSDN|Jargon]
Ripped off from various people

1. 1
2. 2
Rutin
20
3. 3
4. 4
frob
15
5. 5

• 10
• 9
• 13
• 9
• 33
• Forum Statistics

• Total Topics
632592
• Total Posts
3007289

×