由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - 输入输出流,stl,api精通各需要多长时间?
相关主题
C++ Q13: InputC++如何输入的一个小问题
为什么在overloading中,friend <<不能读取private值呢?about namespace
读取数据求教继续请教C++重载问题,>>
how to read a sentence into a vector of string?能否对某个库进行操作符重载?
请教一个C++关于输入输出的问题c++小问题
再问两个C++问题请问一个入门级 dynamic memory 的问题
Why should i include .cpp instead of .h三个C syntax 弱问题
问一个有关iostream的问题one question about operator delete
相关话题的讨论汇总
话题: istream话题: getline话题: standard话题: read话题: void
进入Programming版参与讨论
1 (共1页)
g*****e
发帖数: 172
1
c++的水太深了. 能不能各推荐一本书? 謝謝.
e*****r
发帖数: 379
e*****r
发帖数: 379
3
ISO/IEC JTC1 SC22 WG21 N3290
e*****r
发帖数: 379
4
Before anything above, please read a STANDARD textbook on data structure and
algorithms...
Fetch the preprocessor information, so you will not get lost if you are from
Java/C#,all kinds of functional/scripting language
e*****r
发帖数: 379
5
Before anything above, please read a STANDARD textbook on data structure and
algorithms...
Fetch the preprocessor information, so you will not get lost if you are from
Java/C#,all kinds of functional/scripting language
e*****r
发帖数: 379
6
Before anything above, please read a STANDARD textbook on data structure and
algorithms...
Fetch the preprocessor information, so you will not get lost if you are from
Java/C#,all kinds of functional/scripting language
For APIs: read Windows Programming and get WinSDK examples, go to read some 1codes from codeplex.com. Do some practice with any dll you have or programmed. Then you may be set for a while...
g*****e
发帖数: 172
7
数据结构已经学过.the thing is,这3个方面,权威的书每本都是1000页左右的字典那么
厚,中文版还读得快点,英文版的就慢了...

and
from
some 1codes from codeplex.com. Do some practice with any dll you have or
programmed. Then you may be set for a while...

【在 e*****r 的大作中提到】
: Before anything above, please read a STANDARD textbook on data structure and
: algorithms...
: Fetch the preprocessor information, so you will not get lost if you are from
: Java/C#,all kinds of functional/scripting language
: For APIs: read Windows Programming and get WinSDK examples, go to read some 1codes from codeplex.com. Do some practice with any dll you have or programmed. Then you may be set for a while...

t****t
发帖数: 6806
8
if you want to use iostream and stl (BTW iostream is a part of stl), you don
't have to be jin tong. jin tong is for library writer who want to extend
the library. normal user just call functions.

【在 g*****e 的大作中提到】
: 数据结构已经学过.the thing is,这3个方面,权威的书每本都是1000页左右的字典那么
: 厚,中文版还读得快点,英文版的就慢了...
:
: and
: from
: some 1codes from codeplex.com. Do some practice with any dll you have or
: programmed. Then you may be set for a while...

g*****e
发帖数: 172
9
哎,最近看输入输出流,马上迷糊,trait class,pos_type,off_type,basic_istream等让
我迷茫.

don

【在 t****t 的大作中提到】
: if you want to use iostream and stl (BTW iostream is a part of stl), you don
: 't have to be jin tong. jin tong is for library writer who want to extend
: the library. normal user just call functions.

t****t
发帖数: 6806
10
no, most ppl don't need that. just know istream and ostream and their
variations is enough (istream is basic_istream, similar for ostream).
their variations include ifstream/ofstream, istringstream/ostringstream.
just know op<< for output, op>> for input, op! (usually you need that
instead of eof() member) to check eof, clear() for opening another file,
manipulators (such as setw(), endl, hex, etc.) for formating, and getline()
for reading a whole line. these are enough for 90% of ppl dealing with text
i/o. some ppl need seekg() to seek.

【在 g*****e 的大作中提到】
: 哎,最近看输入输出流,马上迷糊,trait class,pos_type,off_type,basic_istream等让
: 我迷茫.
:
: don

相关主题
再问两个C++问题C++如何输入的一个小问题
Why should i include .cpp instead of .habout namespace
问一个有关iostream的问题继续请教C++重载问题,>>
进入Programming版参与讨论
g*****e
发帖数: 172
11
看到这种语法,我不懂:
while (getline(...)) { }
getline()返回值是一个istream&,用在while()语句里怎么来判断true or false?
istream是一个class,不是一个值啊.

.
)
text

【在 t****t 的大作中提到】
: no, most ppl don't need that. just know istream and ostream and their
: variations is enough (istream is basic_istream, similar for ostream).
: their variations include ifstream/ofstream, istringstream/ostringstream.
: just know op<< for output, op>> for input, op! (usually you need that
: instead of eof() member) to check eof, clear() for opening another file,
: manipulators (such as setw(), endl, hex, etc.) for formating, and getline()
: for reading a whole line. these are enough for 90% of ppl dealing with text
: i/o. some ppl need seekg() to seek.

g*****e
发帖数: 172
12
对,我知道basic_istream,basic_ostream都是模板,istream,ostream是用的这2个模板.

.
)
text

【在 t****t 的大作中提到】
: no, most ppl don't need that. just know istream and ostream and their
: variations is enough (istream is basic_istream, similar for ostream).
: their variations include ifstream/ofstream, istringstream/ostringstream.
: just know op<< for output, op>> for input, op! (usually you need that
: instead of eof() member) to check eof, clear() for opening another file,
: manipulators (such as setw(), endl, hex, etc.) for formating, and getline()
: for reading a whole line. these are enough for 90% of ppl dealing with text
: i/o. some ppl need seekg() to seek.

b******n
发帖数: 592
13
C++ Standard Library..印刷很好,读起来不累。STL,和IO都覆盖得很全

【在 g*****e 的大作中提到】
: c++的水太深了. 能不能各推荐一本书? 謝謝.
g*****e
发帖数: 172
14
恩.我也准备看.你看的英文版还是中文版? 有1千页左右呢.

【在 b******n 的大作中提到】
: C++ Standard Library..印刷很好,读起来不累。STL,和IO都覆盖得很全
t****t
发帖数: 6806
15
if istream& is cast to bool, then it basically test whether it's in good
state. if it is not in good state(), it could be eof() or read/write error.
most likely eof(). that's why i said you need to check opeator!() (actually
it's not operator!(), but operator void*(), then test whether it's NULL)
see http://www.parashift.com/c++-faq-lite/input-output.html#faq-15.4

【在 g*****e 的大作中提到】
: 看到这种语法,我不懂:
: while (getline(...)) { }
: getline()返回值是一个istream&,用在while()语句里怎么来判断true or false?
: istream是一个class,不是一个值啊.
:
: .
: )
: text

e*****r
发帖数: 379
16
really don't know how much programming experience you have!
http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread
a***y
发帖数: 2803
17
我说的是getline()这个函数的返回值是istream&,compiler把它转变成了boolean.

【在 e*****r 的大作中提到】
: really don't know how much programming experience you have!
: http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread

r*********r
发帖数: 3195
18
stl, iostream 直接看看源码就明白了.
除了源码, 其他的都是二手资料, 有可能越看越糊涂.
e*****r
发帖数: 379
19
这个使用的是getline() return 回来的状态数值, 成功return 1, 否则return 0. 不
管是eofbit/failbit,badbit et al...

【在 a***y 的大作中提到】
: 我说的是getline()这个函数的返回值是istream&,compiler把它转变成了boolean.
t****t
发帖数: 6806
20
no, getline returns the istream you called with, and istream is cast to void
*, in turn convert to bool.

【在 e*****r 的大作中提到】
: 这个使用的是getline() return 回来的状态数值, 成功return 1, 否则return 0. 不
: 管是eofbit/failbit,badbit et al...

相关主题
能否对某个库进行操作符重载?三个C syntax 弱问题
c++小问题one question about operator delete
请问一个入门级 dynamic memory 的问题基于macro的meta programming真难懂
进入Programming版参与讨论
e*****r
发帖数: 379
21
see! thanks
http://www.parashift.com/c++-faq-lite/input-output.html
Just wonder if C++ compiler is still a blackbox?
Are there any (commercial) secrets to avoid dummy users to know?

void

【在 t****t 的大作中提到】
: no, getline returns the istream you called with, and istream is cast to void
: *, in turn convert to bool.

g*****e
发帖数: 172
22
恩,终于搞懂了,原来这么简单.
在while (getline()) {}中,getline()返回的是一个istream,而在while()里面应该是一个bool,或者int,char,pointer.所以,compiler 就很辛勤地在istream的所有函数和继承的函数里面查找有没有把istream转变成bool,int,char 或者pointer返回的函数,于是找到了operator void*(),竟然是一个隐式转换.compiler真聪明勤劳.
用函数fail()检查failbit,badbit是否set.
operator void* () const {}
这个函数的返回值有2种,一种是null(也就是0),另外一种返回值是(void*)this.竟然把
this给cast成了一个generic pointer.

.
actually

【在 t****t 的大作中提到】
: if istream& is cast to bool, then it basically test whether it's in good
: state. if it is not in good state(), it could be eof() or read/write error.
: most likely eof(). that's why i said you need to check opeator!() (actually
: it's not operator!(), but operator void*(), then test whether it's NULL)
: see http://www.parashift.com/c++-faq-lite/input-output.html#faq-15.4

g*****e
发帖数: 172
23
正确.

void

【在 t****t 的大作中提到】
: no, getline returns the istream you called with, and istream is cast to void
: *, in turn convert to bool.

b******n
发帖数: 592
24
英文版,hardcopy。。风格比较适合我,介于reference和book之间

【在 g*****e 的大作中提到】
: 恩.我也准备看.你看的英文版还是中文版? 有1千页左右呢.
a***y
发帖数: 2803
25
恩,正在看,642页.

【在 b******n 的大作中提到】
: 英文版,hardcopy。。风格比较适合我,介于reference和book之间
1 (共1页)
进入Programming版参与讨论
相关主题
one question about operator delete请教一个C++关于输入输出的问题
基于macro的meta programming真难懂再问两个C++问题
深情的呼唤师傅们!C++做题做不出来啦!Why should i include .cpp instead of .h
师傅们,C++概念题,弟子有礼了问一个有关iostream的问题
C++ Q13: InputC++如何输入的一个小问题
为什么在overloading中,friend <<不能读取private值呢?about namespace
读取数据求教继续请教C++重载问题,>>
how to read a sentence into a vector of string?能否对某个库进行操作符重载?
相关话题的讨论汇总
话题: istream话题: getline话题: standard话题: read话题: void