www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/27/00:08:17

From: ghost AT mail DOT atcon DOT com (Ghost)
Newsgroups: comp.lang.c++,comp.os.msdos.djgpp
Subject: Re: Using cin.get() Outside Of main()
Date: Thu, 27 Feb 1997 03:23:21 GMT
Organization: Auracom Internet Services
Lines: 35
Message-ID: <5f2u6v$1p6$1@thor.atcon.com>
References: <5f2ag5$l9m AT boursy DOT news DOT erols DOT com>
NNTP-Posting-Host: 207.179.144.143
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

donjr AT erols DOT com (No One Important) wrote:

>I am having trouble using cin.get() outside of the main function.

>I prompt the user for input eg.

>char FullName[256];
>cout << "Enter Your Full Name\n:";
>cin.get(FullName,256);

>and the program compiles without error, but when I run it it skips
>right by the cin.get() and displays

>Enter Your Full Name
>:
>(The rest of the program)

>I have been able to use it in main, however, with the way my program
>works, it is impossible to put it in main without throwing the whole
>thing off.

>Please e-mail any advice to
>donjr AT erols DOT com

>Thank you,
>David Loose

Well, if I am not mistaken cin.get() just grabs a character from the
buffer and eats it.  I think, by looking at your code, you mean to use
the function cin.getline().





- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019