设为首页 加入收藏

TOP

4.4 A C++ Implementation(2)
2013-10-07 14:27:03 来源: 作者: 【 】 浏览:50
Tags:4.4 Implementation

To manage strings, the class uses the standard C++(www.cppentry.com) string and vector classes rather than C-style strings. There is no non-existent state for a string: “empty” means only that the length is zero, and there is no equivalent of NULL, so we can’t use that as an end of file signal. Thus Csv::getline returns the input line through an argument by reference, reserving the function value itself for end of file and error reports.

图4.4 A C++(www.cppentry.com) Implementation(1) 

图4.4 A C++(www.cppentry.com) Implementation(2) 

The += operator is overloaded to append a character to a string.

Minor changes are needed in endofline. Again, we have to read the input a character at a time, since none of the standard input routines can handle the variety of inputs.

图4.4 A C++(www.cppentry.com) Implementation(3) 

【责任编辑:王苑 TEL:(010)68476606】


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇4.4 A C++ Implementation(3) 下一篇4.4 A C++ Implementation(1)

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: