还可以用 istream::getline()
所在版块:求学狮城 发贴时间:2003-02-20 21:12  评分:

用户信息
复制本帖HTML代码
高亮: 今天贴 X 昨天贴 X 前天贴 X 
eg. str = cin.getline(),具体如下:

istream& getline( char* pch, int nCount, char delim = '\n' );

istream& getline( unsigned char* puch, int nCount, char delim = '\n' );

istream& getline( signed char* psch, int nCount, char delim = '\n' );

Parameters

pch, puch, psch

A pointer to a character array.

nCount

The maximum number of characters to store, including the terminating NULL.

delim

The delimiter character (defaults to newline).
.
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!

Put your OWN COOL signature here!
 相关帖子 我要回复↙ ↗回到正文
Anyone can give an example of 香陵居士   (48 bytes , 431reads )
可以用 istream::get() Yup   (1477 bytes , 303reads )
还可以用 istream::getline() Yup   (444 bytes , 354reads )