TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: PHIL OHL
from: PETER GARNER
date: 1998-03-22 23:20:00
subject: I`m an idiot

PO> I am fairly new at C++ and i have encountered a pretty major
Well, welcome to hell, kid.  Now every two bit that wanders into town
will be trying to take you down, just to make a name for himself. 
Well you asked for it.
PO> to use 'getline' in its place. However 'getline' doesn't work all
PO> the time either especially when i do something like:
PO> 
PO> char name[20];
PO> cout<<"Enter name: ";
PO> getline(name, cin);
PO> 
PO> It just wont work.  How would I remedy this problem without
PO> limiting the user to just their first or last name.
Probably won't even compile, !!!  Try this one instead :
cin.getline ( name , 20 ) ;
cin is an object of class  istream.  The istream class has the getline
method defined as a class member method.  Which compiler are
you using, just for my curiosity?
Thanks
Peter
---
 þ KWQ/2 1.2i þ Microsoft's Motto: We're the leaders, wait for us!
---------------
* Origin: St. Louis Users Group (1:100/4)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.